Comments (3)
Thanks for the bug report @Mahdi-py. Indeed, this is due to the way the AST visitor is implemented. I'll take a look at a possible fix in the near future.
from radon.
I noticed the same issue whilst reading the code itself. Am I right assuming that adding visitor.classes_complexity
to the following sum would fix this?
Lines 310 to 314 in 44655c8
Alternatively change
body_complexity += (
visitor.complexity
+ visitor.functions_complexity
+ len(visitor.functions)
)
to
body_complexity += (
visitor.total_complexity
+ len(visitor.functions)
)
and change the off
property of the visitor to True
from radon.
That fix would allow Radon to count the complexity of all the code within the nested classes. That's the correct thing to do. However, it won't cause the nested classes to be shown in the reports. Since we do not report nested functions, I think that's also consistent with the rest of the code. I'll commit this fix after writing some test cases.
from radon.
Related Issues (20)
- Radon ignores '--ignore' CLI argument HOT 1
- Feature Request: Cohesion and Coupling metrics HOT 1
- Incorrect CC for try-except-else else blocks containing multiple statements HOT 1
- Can't get the actual complexity for block of code HOT 1
- Installing radon breaks flake8 HOT 8
- Support of pyproject.toml file HOT 1
- Radon struggles to collect statistics from large files HOT 2
- Is Randon able to run into Java files? HOT 2
- [feature] Add support for pre-commit HOT 5
- Python 3.10: match-case syntax not yet supported by radon? HOT 1
- summary not shown when using --json flag HOT 3
- 5.1.0: sphinx warnings HOT 2
- Misspelled 'clasification' in markdown exports HOT 1
- Documentation link outdated HOT 2
- wrong complexity for linear function HOT 1
- New release to drop future package HOT 7
- 5.1.0 - wrong import HOT 2
- Support mi/hal in flake8 plugin
- Radon crashes on unrelated config option in pyproject.toml HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from radon.