Skip to content

Commit 963d34c

Browse files
Copilotjamesfredley
andcommitted
Complete unused code detection system with applied configurations and documentation
Co-authored-by: jamesfredley <6969748+jamesfredley@users.noreply.github.com>
1 parent 6d65dfe commit 963d34c

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,38 @@ Once your Apache Grails Application is created, you can start it with the comman
112112

113113
For further information, please consult the [documentation](https://docs.grails.org).
114114

115+
## Code Quality and Maintenance
116+
117+
### Unused Code Detection
118+
119+
Apache Grails includes comprehensive unused code and dead file detection capabilities to help maintain clean, efficient codebases. The system combines static analysis with dead file detection to identify potentially unused code elements.
120+
121+
#### Quick Start
122+
123+
```bash
124+
# Analyze all Grails modules
125+
./gradlew detectUnusedCodeAll
126+
127+
# Analyze specific modules only
128+
./gradlew detectUnusedCodeGrailsModules
129+
130+
# Analyze individual module
131+
./gradlew :grails-core:detectDeadFiles
132+
./gradlew :grails-core:codenarcMain
133+
```
134+
135+
#### Features
136+
137+
- **Dead File Detection**: Identifies files not referenced anywhere in the codebase
138+
- **Unused Code Analysis**: Detects unused variables, methods, fields, and imports using CodeNarc
139+
- **Comprehensive Reporting**: HTML and text reports with actionable insights
140+
- **Multi-Module Support**: Project-wide analysis across all Grails modules
141+
- **CI/CD Integration**: Automated detection in build pipelines
142+
143+
#### Documentation
144+
145+
For complete usage instructions, configuration options, and best practices, see [docs/UNUSED_CODE_DETECTION.md](docs/UNUSED_CODE_DETECTION.md).
146+
115147
## Licensing
116148

117149
Apache Grails is licensed under the Apache License, Version 2.0. For details, see

grails-core/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ plugins {
2323
id 'project-report'
2424
}
2525

26+
// Apply centralized unused code detection
27+
apply from: rootProject.file('gradle/codenarc-config.gradle')
28+
apply from: rootProject.file('gradle/unused-code-detection.gradle')
29+
2630
version = projectVersion
2731
group = 'org.apache.grails'
2832

grails-databinding/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ plugins {
2323
id 'project-report'
2424
}
2525

26+
// Apply centralized unused code detection
27+
apply from: rootProject.file('gradle/codenarc-config.gradle')
28+
apply from: rootProject.file('gradle/unused-code-detection.gradle')
29+
2630
version = projectVersion
2731
group = 'org.apache.grails'
2832

grails-web-common/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ plugins {
2323
id 'project-report'
2424
}
2525

26+
// Apply centralized unused code detection
27+
apply from: rootProject.file('gradle/codenarc-config.gradle')
28+
apply from: rootProject.file('gradle/unused-code-detection.gradle')
29+
2630
version = projectVersion
2731
group = 'org.apache.grails.web'
2832

0 commit comments

Comments
 (0)