Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RadonBear fails #609

Closed
adtac opened this issue Jul 23, 2016 · 3 comments
Closed

RadonBear fails #609

adtac opened this issue Jul 23, 2016 · 3 comments
Assignees
Labels

Comments

@adtac
Copy link
Member

adtac commented Jul 23, 2016

def f():
    assert True
    assert True
    assert True
    assert True
    assert True
    assert True
    assert True
    assert True
    assert True
    assert True
    assert True
@gitmate-bot
Copy link
Collaborator

Thanks for reporting this issue! A coalaian will look at it soon.

@blueyed
Copy link

blueyed commented Jul 23, 2016

The problem is that the SourcePositions from radon.complexity.cc_visit is None and 0.

The following hack would fix it:

 bears/python/RadonBear.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git i/bears/python/RadonBear.py w/bears/python/RadonBear.py
index eb9f3f7..86b74ba 100644
--- i/bears/python/RadonBear.py
+++ w/bears/python/RadonBear.py
@@ -45,8 +45,9 @@ def run(self, filename, file,
             if severity is None:
                 continue

+            col = visitor.col_offset if visitor.col_offset else None
             visitor_range = SourceRange.from_values(
-                filename, visitor.lineno, visitor.col_offset, visitor.endline)
+                filename, visitor.lineno, col, visitor.endline)
             message = "{} has a cyclomatic complexity of {}".format(
                 visitor.name, rank)

@sils
Copy link
Member

sils commented Jul 23, 2016

@AbdealiLoKo AbdealiLoKo self-assigned this Aug 31, 2016
AbdealiLoKo added a commit that referenced this issue Aug 31, 2016
Radon uses visitor.col_offset as 0 for results where column is not
given. As we use None, we simply map it appropriately.
(As suggested by blueyed)

Fixes #609
AbdealiLoKo added a commit that referenced this issue Aug 31, 2016
Radon uses visitor.col_offset as 0 for results where column is not
given. As we use None, we simply map it appropriately.
(As suggested by blueyed)

Fixes #609
AbdealiLoKo added a commit that referenced this issue Aug 31, 2016
Radon uses visitor.col_offset as 0 for results where column is not
given. As we use None, we simply map it appropriately.
(As suggested by blueyed)

Fixes #609
AbdealiLoKo added a commit that referenced this issue Sep 1, 2016
Radon uses visitor.col_offset as 0 for results where column is not
given. As we use None, we simply map it appropriately.
(As suggested by blueyed)

Fixes #609
AbdealiLoKo added a commit that referenced this issue Sep 2, 2016
Radon uses visitor.col_offset as 0 for results where column is not
given. As we use None, we simply map it appropriately.
(As suggested by blueyed)

Fixes #609
@rultor rultor closed this as completed in 24a0b7c Sep 2, 2016
sils pushed a commit that referenced this issue Sep 2, 2016
Radon uses visitor.col_offset as 0 for results where column is not
given. As we use None, we simply map it appropriately.
(As suggested by blueyed)

Fixes #609
gosom pushed a commit to gosom/coala-bears that referenced this issue Jul 15, 2017
Radon uses visitor.col_offset as 0 for results where column is not
given. As we use None, we simply map it appropriately.
(As suggested by blueyed)

Fixes coala#609
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

5 participants