Commit graph

42 commits

Author SHA1 Message Date
Sijawusz Pur Rahnama
ce3f2b7e4b Add QoL Variable#reference(scope) method 2024-01-01 14:49:27 +01:00
Sijawusz Pur Rahnama
e99a69765f Few refactors 2024-01-01 14:46:32 +01:00
Sijawusz Pur Rahnama
65ab317a3b Merge delegate calls 2024-01-01 14:46:32 +01:00
Sijawusz Pur Rahnama
4ad151e5e0 Do not automatically consider type definitions as referenced 2023-12-28 15:43:29 +01:00
Sijawusz Pur Rahnama
52ccf23ef9 Remove deprecated Assignment#transformed? method 2023-11-14 11:22:17 +01:00
Sijawusz Pur Rahnama
61ccb030bd Fix newly found offenses 2023-11-11 19:08:14 +01:00
Vitalii Elenhaupt
789e1b77e8
fix: crystal next compatibility
refs https://github.com/crystal-lang/crystal/pull/11597
fixes https://github.com/crystal-ameba/ameba/issues/406
2023-10-06 18:57:39 +03:00
Sijawusz Pur Rahnama
596b0dd9d0 Misc tweaks and refactors 2023-06-14 15:06:24 +02:00
Vitalii Elenhaupt
d20cc212b9
Styling changes 2023-02-07 20:03:52 +02:00
Vitalii Elenhaupt
6b2ddcb1d9
Address feedback, add tests 2023-02-07 17:19:04 +02:00
Vitalii Elenhaupt
14a9ec3a75
Incorporate changes for shadowing outer local var 2023-02-04 20:53:41 +02:00
Sijawusz Pur Rahnama
9df66e890b Do not report anonymous block arguments in Lint/UnusedArgument 2022-12-12 18:21:19 +01:00
Sijawusz Pur Rahnama
a8fca61b22 Doc tweaks 2022-12-10 00:20:20 +01:00
Sijawusz Pur Rahnama
db3ef762b9 Uncomment forgotten line 2022-12-08 17:47:22 +01:00
Sijawusz Pur Rahnama
f45d6a2ef0 Fix newly found issue 2022-12-08 02:16:16 +01:00
Sijawusz Pur Rahnama
2113e8c055 Refactor MacroReferenceFinder class a bit 2022-11-28 11:38:41 +01:00
Sijawusz Pur Rahnama
523a622b34 Remove leftover from some merge/rebase gone wrong 2022-11-28 11:38:41 +01:00
Sijawusz Pur Rahnama
8b43a40a65 Misc refactors 2022-11-23 03:22:27 +01:00
Sijawusz Pur Rahnama
e668ba5bf5 Readability-related refactors 2022-11-14 02:26:52 +01:00
Sijawusz Pur Rahnama
d1bfdaabeb Use #in? instead of #includes? in several places
Because:

1. it’s more semantically descriptive
2. it’s shorter
2022-11-14 01:18:43 +01:00
fn ⌃ ⌥
f288cc3c4f
Add Style/GuardClause rule (#254) 2021-12-09 21:33:47 +01:00
Sijawusz Pur Rahnama
43dea0e49d Fix typos throughout the codebase 2021-07-03 14:15:23 +02:00
Sijawusz Pur Rahnama
99da6b6916 Merge remote-tracking branch 'origin/master' into master-into-develop 2021-02-03 22:45:35 +01:00
Vitalii Elenhaupt
51b0a07e81
Avoid exponential recursion while finding variable references in scopes (#203)
* Avoid exponential recursion while finding variable references in scopes

* Adjust source example in test
2021-01-31 16:40:44 +02:00
Sijawusz Pur Rahnama
7b3c814914 Fix newly found issues 2021-01-28 01:03:48 +01:00
Vitalii Elenhaupt
7aa7efd4bd Do not report if variable is assigned and referenced in MacroFor/MacroIf/MacroExpression
closes #194
2021-01-20 13:14:42 +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
Sijawusz Pur Rahnama
06852c490b Followup to #185 2021-01-17 13:25:50 +01:00
Vitalii Elenhaupt
b5bd76dfa8
Useless Assign: ignore variables with '_' prefix
closes #164
2020-08-20 21:15:58 +03:00
Vitalii Elenhaupt
458c492730
Do not report shadowing outer local var is var is declared below the
shadowed var

closes #144
2020-04-10 10:44:42 +03:00
Vitalii Elenhaupt
4f185db0a2
New rule: SharedVarInSpawn
closes #132
2020-03-25 17:52:20 +02:00
Vitalii Elenhaupt
cc3200f3cf
Reformat sources 2020-01-11 23:58:06 +02:00
Vitalii Elenhaupt
74dfa0b934
Lint/UselessAssign: ignore transformed assignemnts by the compiler
closes #127
2020-01-11 23:51:28 +02:00
Vitalii Elenhaupt
6b56c87e78
Shadowing via short instance variable syntax
closes #122
2019-11-11 15:51:09 +02:00
Vitalii Elenhaupt
9885457227
Track issue.end_location properly 2018-11-24 19:38:13 +02:00
Vitalii Elenhaupt
c12b4f1aa5 Shadowed argument 2018-05-29 09:47:32 +03:00
Vitalii Elenhaupt
bf907ee98b
Rework variable references detection in macro 2018-05-12 20:08:24 +03:00
Vitalii Elenhaupt
415432713a
Prevent false positiveness cause by macro literals
https://github.com/crystal-lang/crystal/pull/6055#issuecomment-386376227
2018-05-12 17:37:54 +03:00
V. Elenhaupt
c2aa526e21
Unused argument rule (#52)
* Unused argument rule

* IgnoreDefs, IgnoreBlocks, IgnoreProcs parameters

* Implicit reference by super keyworkd

* Handle macro arguments
2018-05-08 22:00:17 +03:00
Vitalii Elenhaupt
cc71511080
Use Var#special_var? to check if var is special 2018-05-04 16:25:44 +03:00
V. Elenhaupt
6475c2bb25
Variable scope & useless assignments (#41)
* AST::Visitor -> AST::NodeVisitor

* Scope & ScopeVisitor

* Useless assignment rule

* Instance vars and useless assignments

* Multiple assigns one by one

* Support outer scope

* Variable used in the useless assignment

* Support OpAssign & MultiAssign

* Captured by block

* Variable, Assignment, Reference & Refactoring

* Variable has references, Assignment can be referenced

* Branch entity

* Handle useless assignments in branches

* Handle assignments in a loop

* Handle branch equality

* Handle special var `$?` assignment

* Improve captured by block stuff

* Avoid assignments in property definitions

(UselessAssign rule reports an warning)

* Support MacroIf and MacroFor branches

* Handle assignments with shadowed vars in inner scopes

* Add method arguments as scope variables

* Handle case if branch is blank

* Top level scope

* Handle case when branch is nop?
2018-05-03 18:57:47 +03:00