bblfsh / sonar-checks Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
while implementing one of the rules in python we were using bblfsh_sonar_checks.util package. It throws following error -
root@ip-172-31-34-50:~/sourced/git/source-d/Python# python3 if_duplicate_rule.py
Traceback (most recent call last):
File "if_duplicate_rule.py", line 1, in
import bblfsh_sonar_checks.utils as utils
File "/usr/local/lib/python3.5/dist-packages/bblfsh_sonar_checks/init.py", line 1, in
from bblfsh_sonar_checks.utils import (
File "/usr/local/lib/python3.5/dist-packages/bblfsh_sonar_checks/utils.py", line 47
self.modifiers: List[str] = []
^
SyntaxError: invalid syntax
All the rules output what looks like JSON ๐ but
python3 -m bblfsh_sonar_checks --language=java \
| --enable=RSPEC-1143 \
| ./bblfsh_sonar_checks/fixtures/java/RSPEC-1143.java \
| jq '.RSPEC-1143'
results in parse error: Invalid numeric literal at line 1, column 14
.
A bit confused by findings of RSPEC-1143.
$ python3 -m bblfsh_sonar_checks --language=java --enable=RSPEC-1143 ./bblfsh_sonar_checks/fixtures/java/RSPEC-1143.java
on modified .java
class ThrowInFinally {
void test() {
try {
} finally {
throw new RuntimeException();
return;
}
}
void test2() {
throw new RuntimeException();
}
}
report 3 findings, although according to RSPEC-1143 it seems like it should report only 2 messages for single jump statement inside finally
block.
Full output in details
{'RSPEC-1143': [{'msg': "Don't throw or return inside a finally (line {})",
'pos': offset: 87
line: 5
col: 13
},
{'msg': "Don't throw or return inside a finally (line {})",
'pos': offset: 129
line: 6
col: 13
},
{'msg': "Don't throw or return inside a finally (line {})",
'pos': offset: 180
line: 10
col: 9
}]}
One can see https://pypi.org/project/bblfsh_sonar_checks/ ๐ but it would be also supe-useful to publish on pypi as a part of release process, a newer versions e.g. https://github.com/bblfsh/sonar-checks/releases/tag/v0.2.0 of this library, that exposes
run_check(check, lang, uast)
list_checks(lang)
and has package description instead of The author of this package has not provided a project description
with simple example of calling this API
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.