Commit graph

56 commits

Author SHA1 Message Date
Sijawusz Pur Rahnama
61ccb030bd Fix newly found offenses 2023-11-11 19:08:14 +01:00
Sijawusz Pur Rahnama
5cff76071a No need for such micro-optimizations, LLVM takes care of those 2023-07-02 14:34:25 +02:00
Sijawusz Pur Rahnama
596b0dd9d0 Misc tweaks and refactors 2023-06-14 15:06:24 +02:00
Sijawusz Pur Rahnama
1931a5f4ef Make skip a named argument 2023-06-12 23:17:14 +02:00
Sijawusz Pur Rahnama
c09b36799a Make AST::NodeVisitor::Category a flag enum 2023-06-12 23:17:14 +02:00
Sijawusz Pur Rahnama
38b6751bc0 Add AST::NodeVisitor::Category simplifying code a bit 2023-06-12 23:17:14 +02:00
Sijawusz Pur Rahnama
94e31d4685 Do the same in NodeVisitor 2023-06-08 04:28:37 +02:00
Sijawusz Pur Rahnama
e12d72cc88 Set the ASTNode#visibility as well 2023-06-08 04:28:17 +02:00
Sijawusz Pur Rahnama
7caa47fb6a Several small refactors 2023-06-08 02:04:30 +02:00
Sijawusz Pur Rahnama
4c740f394a Implement Scope#visibility 2023-06-08 01:58:58 +02:00
Sijawusz Pur Rahnama
85c3db4d74 Move NODES constant into its proper namespace 2023-05-31 13:15:01 +02:00
Vitalii Elenhaupt
14a9ec3a75
Incorporate changes for shadowing outer local var 2023-02-04 20:53:41 +02:00
Vitalii Elenhaupt
ddbcf5cb3f
fix(lint): useless assignment for type definition
closes #342
2023-02-04 16:57:46 +02:00
Sijawusz Pur Rahnama
bb0c0eeec6 Consider previous_def implicitly accessing variables, in the same way as super does 2022-12-15 18:35:16 +01:00
Sijawusz Pur Rahnama
6ffb635dcc Add Scope#yields? 2022-12-15 18:35:16 +01:00
Sijawusz Pur Rahnama
a8fca61b22 Doc tweaks 2022-12-10 00:20:20 +01:00
Sijawusz Pur Rahnama
134963ece7 Minor details 2022-11-28 11:38:41 +01:00
Sijawusz Pur Rahnama
2c67fe2c3f Use tuple instead of an array 2022-11-23 03:23:42 +01:00
Sijawusz Pur Rahnama
8b43a40a65 Misc refactors 2022-11-23 03:22:27 +01:00
Sijawusz Pur Rahnama
4500181ddb Remove redundant blank comment lines 2022-11-23 03:21:15 +01:00
Sijawusz Pur Rahnama
e668ba5bf5 Readability-related refactors 2022-11-14 02:26:52 +01:00
Sijawusz Pur Rahnama
a6ebb48f14 Remove redundant parentheses in if expressions
+ `elsif` -> `case`
2022-11-14 01:52:07 +01:00
Sijawusz Pur Rahnama
2e9ef7fcb2 Reword visit(node) methods comment in AST::NodeVisitor 2022-04-04 01:35:59 +02:00
Sijawusz Pur Rahnama
a38cfd1661 Refactor AST::ScopeVisitor similarly to AST::NodeVisitor 2022-04-04 01:35:32 +02:00
Sijawusz Pur Rahnama
3f7ade573a Add ability to skip some of the nodes in AST::ScopeVisitor 2022-04-04 01:34:34 +02:00
fn ⌃ ⌥
f288cc3c4f
Add Style/GuardClause rule (#254) 2021-12-09 21:33:47 +01:00
Caspian Baska
c49c69ed9f
Early return in CountVisitor if macro node
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
2021-06-06 04:12:56 +10:00
Caspian Baska
0ea6238dc6
Count an exhaustive case's complexity as 1 2021-06-05 22:31:58 +10:00
Vitalii Elenhaupt
a64f48b543
ShadowingOuterLocalVar while it is not in macro
closes #224
2021-04-18 20:55:10 +03:00
Sijawusz Pur Rahnama
7b3c814914 Fix newly found issues 2021-01-28 01:03:48 +01:00
Vitalii Elenhaupt
e9ec91654c New Rule: Lint/DuplicatedRequire
closes https://github.com/crystal-ameba/ameba/issues/176
2021-01-17 22:32:24 +02:00
Sijawusz Pur Rahnama
928a260d51 Remove extraneous blank lines 2021-01-17 18:45:14 +01:00
Sijawusz Pur Rahnama
af5d825015 Followup to #185 2021-01-17 18:45:14 +01:00
Vitalii Elenhaupt
db6b54e63c
New rule: Style/IsANil 2020-03-29 19:45:13 +03:00
Brian J. Cardiff
6259e26457 Comply exhaustive case check 2020-03-27 09:25:07 -03:00
Vitalii Elenhaupt
a6958ab455
New rule: EmptyLoop 2020-03-26 10:27:00 +02:00
Vitalii Elenhaupt
4f185db0a2
New rule: SharedVarInSpawn
closes #132
2020-03-25 17:52:20 +02:00
Vitalii Elenhaupt
a5dd07e9e4
New rule: RedundantNext
closes #131
2020-03-24 18:06:01 +02:00
Vitalii Elenhaupt
6b56c87e78
Shadowing via short instance variable syntax
closes #122
2019-11-11 15:51:09 +02:00
Vitalii Elenhaupt
677c75716f
Typeof scope 2019-10-27 21:22:33 +02:00
Vitalii Elenhaupt
94e1d4567a
Properly report performance rules in macros
closes #102
2019-05-05 18:05:08 +03:00
Vitalii Elenhaupt
c95ea297bd
Stop calculating cyclomatic complexity for methods which have Macro conditions (#99) 2019-03-31 20:27:20 +03:00
Sijawusz Pur Rahnama
e8a68a80d5 Fix several misspellings (#94) 2019-02-23 07:06:28 +02:00
Hannes Käufler
e850bff60f Hk cyclomatic complexity (#92)
* Proof of concept for cyclomatic complexity

* Enable configurability of rule

* Use the same nodes to increment the complexity as rubocop

* Fix typo in test description

* Properly indent code and simplify macro

* Move metric into metrics

* Cover a violation supressed by increased threshold

* Extract visitor into its own file

* Document cyclomatic complexity rule and visitor

* Refactor specs to use a macro

* Indent code inside macro

* Replace array with tuple for string formatting.

`Tuple` is stack based, whereas `Array` is allocated on the heap increasing GC pressure.

* Fix formatting

* Enable cyclomatic complexity rule by default
2019-02-16 21:03:44 +02:00
Vitalii Elenhaupt
60ce034f1b
UnusedArgument: fix crystal upgrade regression 2018-12-12 22:21:33 +02:00
V. Elenhaupt
0fd5890738
Extend UnreachableCode rule: handle control flow (#83) 2018-11-22 10:38:32 +02:00
Vitalii Elenhaupt
eca0f3f350
Handle raise, exit, abort in unreachable code 2018-11-11 20:33:48 +02:00
Vitalii Elenhaupt
67d76116f7
Basic implementation of UnreachableCode rule 2018-11-05 21:39:27 +02:00
V. Elenhaupt
cb5f802012
Correctly process record declaration at a top level (#78) 2018-09-07 00:47:02 +03:00
Vitalii Elenhaupt
04c7300964
Handle type declarations in scopes
closes #66
2018-06-23 08:48:13 +03:00