Commit Graph

288 Commits

Author SHA1 Message Date
Jeroen Engels
c67aa1321c WIP: Don't report custom type constructors used as phantom types 2020-03-09 22:42:16 +01:00
Jeroen Engels
e438da283d Copy over NoUnused.CustomTypeConstructors temporarily 2020-03-09 21:21:38 +01:00
Jeroen Engels
c141fdb1ae Rename module rule's phantom fields to canCollectProjectData 2020-03-08 00:54:18 +01:00
Jeroen Engels
0d33ab05e7 Improve the error message when Review.Test.runOnModules is given an empty list 2020-03-07 20:11:07 +01:00
Jeroen Engels
801fae798a Remove version from dependency data 2020-03-07 19:57:16 +01:00
Jeroen Engels
37981b65db Make Dependencies opaque 2020-03-07 18:38:39 +01:00
Jeroen Engels
ec326af739 Write NoDebugTodoOrToString rule 2020-03-07 16:09:35 +01:00
Jeroen Engels
8f1ec1dd3a Write NoDebugLog rule 2020-03-07 16:09:35 +01:00
Jeroen Engels
5cfd68fb6b Rename withModuleDependenciesVisitor to withDependenciesModuleVisitor 2020-03-02 22:53:37 +01:00
Jeroen Engels
c09c46e4eb Rename withProjectElmJsonVisitor to withElmJsonProjectVisitor 2020-03-02 22:52:31 +01:00
Jeroen Engels
8406c29fd3 Rename withModuleElmJsonVisitor to withElmJsonModuleVisitor 2020-03-02 22:51:25 +01:00
Jeroen Engels
0b0b6d1b85 Use "List nothing" instead of "List Error" where possible 2020-02-28 17:11:15 +01:00
Jeroen Engels
d7f645241d Continue documentation for project rules 2020-02-27 19:19:33 +01:00
Jeroen Engels
fbcc11d6a9 Simplify Scope by not having a setter and getter 2020-02-16 23:29:11 +01:00
Jeroen Engels
c2c53fdbe6 Rename Rule.FileKey to Rule.ModuleKey 2020-02-16 21:54:05 +01:00
Jeroen Engels
382a6c8604 Add NoInvalidLicense 2020-02-16 21:40:59 +01:00
Jeroen Engels
c652a24d48 Store more information about the project's dependencies 2020-02-16 21:40:59 +01:00
Jeroen Engels
a91d66ea60 Add Review.Test.expectErrorsForElmJson 2020-02-16 16:56:33 +01:00
Jeroen Engels
0f39773e75 Change how dependencies are stored, and add NoUnused.Dependencies rule 2020-02-16 16:56:33 +01:00
Jeroen Engels
6bfc9f0757 Remove unused elements in tests 2020-02-16 16:56:19 +01:00
Jeroen Engels
24723bf066 Make it possible to report errors in the elm.json file 2020-02-16 16:56:19 +01:00
Jeroen Engels
f28b7698d7 Give a nicer error message when under is passed empty 2020-02-11 18:47:28 +01:00
Jeroen Engels
b72326085b Give a nicer error message in tests when the location could not be found 2020-02-11 18:12:51 +01:00
Jeroen Engels
e00ab39cd7 Fail tests if there are unknown module names in the expected errors list for expectErrorsForModules 2020-02-11 17:46:06 +01:00
Jeroen Engels
ac0ec7fe34 Rename traversingImportedModulesFirst to withContextFromImportedModules 2020-02-10 23:18:09 +01:00
Jeroen Engels
89a3a3d1b4 Rename withDependenciesVisitor to withModuleDependenciesVisitor 2020-01-27 17:18:06 +01:00
Jeroen Engels
0cada05fe3 Rename withElmJsonVisitor to withModuleElmJsonVisitor 2020-01-27 17:18:06 +01:00
Jeroen Engels
66bf74baac Rename withFinalEvaluation to withFinalModuleEvaluation 2020-01-26 13:28:57 +01:00
Jeroen Engels
ca4515ed2e More "global" to "project" renaming 2020-01-26 13:25:09 +01:00
Jeroen Engels
35c6e53664 Rename fromModuleToGlobal -> fromModuleToProject and fromGlobalToModule -> fromProjectToModule 2020-01-26 13:19:46 +01:00
Jeroen Engels
d2f2ffa2cd Rename Multi/Single to Project/Module 2020-01-20 08:34:52 +01:00
Jeroen Engels
d397c57189 Remove withInitialContext and change the rule schema's phantom types 2020-01-20 08:34:52 +01:00
Jeroen Engels
a2a5831e0b Explain in which module we are getting an unexpected test result 2020-01-15 16:35:03 +01:00
Jeroen Engels
d7d49501e1 Replace "Never" phantom types by record types 2020-01-15 16:35:03 +01:00
Jeroen Engels
eee29d7963 NoUnusedExports: Do not report tests or ReviewConfig.config 2020-01-15 16:35:03 +01:00
Jeroen Engels
691a22e5a7 NoUnusedExports: Mark types used in type alias and custom type arguments as used 2020-01-15 16:35:03 +01:00
Jeroen Engels
b654daa301 Remove unused code and dependencies 2020-01-15 09:54:26 +01:00
Jeroen Engels
acd63f22dd NoUnusedExports: Report unused types 2020-01-14 12:50:07 +01:00
Jeroen Engels
511db00e29 NoUnusedExports: Do not report elements that are not defined 2020-01-14 09:50:13 +01:00
Jeroen Engels
251bca2c12 Use Scope in NoUnusedExports to know about the exports from other modules 2020-01-14 09:50:13 +01:00
Jeroen Engels
c21fbff07e NoUnusedExports: Don't report used functions or values 2020-01-14 09:50:13 +01:00
Jeroen Engels
56e766ad62 Register type constructors from visited modules in Scope 2020-01-14 09:50:13 +01:00
Jeroen Engels
061a950679 Register types from visited modules in Scope 2020-01-14 09:50:13 +01:00
Jeroen Engels
6ca138db11 Register exposes values only if they are exposed 2020-01-14 09:50:13 +01:00
Jeroen Engels
0362f5b3e3 Register values from visited modules in Scope 2020-01-14 09:50:13 +01:00
Jeroen Engels
25601e6b24 Rework Scope to work for multi file rules 2020-01-14 09:50:13 +01:00
Jeroen Engels
13d845db25 Copy Scope 2020-01-14 09:50:13 +01:00
Jeroen Engels
dbf56e1e65 Add NoUnusedExports rule 2020-01-14 09:50:13 +01:00
Jeroen Engels
c2ea2f8136 Rename runMulti* to runOnModules* 2020-01-05 19:35:41 +01:00
Jeroen Engels
3bd94e4127 Replace expectErrorsForFiles by expectErrorsForModules 2020-01-05 18:44:16 +01:00
Jeroen Engels
c388770501 Have the tests explain which source code failed to parse when there are multiple 2020-01-05 11:04:20 +01:00
Jeroen Engels
a674ee4763 Do not consider a package module used when it contains a main function 2020-01-04 18:34:12 +01:00
Jeroen Engels
c3759a182d Add missing tests for NoUnusedModules 2020-01-04 15:12:00 +01:00
Jeroen Engels
6b371bf569 Fail tests when there are duplicate module names 2020-01-04 14:21:28 +01:00
Jeroen Engels
7b786d9a2d Add error message when the number of lists of errors is unexpected 2020-01-04 12:40:11 +01:00
Jeroen Engels
8fa9ab49a1 Add functions to be able to test multi rules 2020-01-03 17:12:43 +01:00
Jeroen Engels
6c7d2580cd Set the correct VariableType for ports 2019-12-07 15:29:20 +01:00
Jeroen Engels
fe7b3da438 Make scope understand case..of expressions 2019-11-27 22:30:01 +01:00
Jeroen Engels
4ad1d33d41 Make scope understand parameters 2019-11-27 00:17:14 +01:00
Jeroen Engels
581b77fd17 Make Scope understand exposing(Foo(..)) 2019-11-24 20:29:05 +01:00
Jeroen Engels
45861e3de7 Rename setter and getter fields for scope 2019-11-24 20:28:41 +01:00
Jeroen Engels
b8b6c6758c Make scope understand the elm/core prelude 2019-11-24 20:28:41 +01:00
Jeroen Engels
f6b5b0c4c3 Add tests for Scope 2019-11-24 20:28:41 +01:00
Jeroen Engels
a7c4b86a12 Push a new scope when entering a let..in block 2019-11-23 20:22:42 +01:00
Jeroen Engels
688eb3a1d1 Add test to make sure visitors are called in the expected order 2019-11-23 20:22:42 +01:00
Jeroen Engels
97d45987bd Call multiple declaration and expression visitors in reverse order on exit 2019-11-23 20:22:42 +01:00
Jeroen Engels
28e9dfc401 Make scope register top level variables 2019-11-22 00:00:13 +01:00
Jeroen Engels
0a9a4d8853 Make Scope understand exposing (..) 2019-11-20 11:16:37 +01:00
Jeroen Engels
75bb616686 Make Scope understand the exposing part when importing a module 2019-11-20 09:48:57 +01:00
Jeroen Engels
fad39c1397 Start working on a scope module
This module should help to write rules that detect the use of a given
function.
2019-11-20 09:48:57 +01:00
Jeroen Engels
5977bb06f2 Remove the Review.Util module 2019-09-29 10:51:29 +02:00
Jeroen Engels
8e48d01e66 Change the project's API from Lint* to Review* 2019-09-28 23:47:02 +02:00
Jeroen Engels
3645acb99e Reword the error message in the case of a missing fixes test failure 2019-09-17 19:56:15 +02:00
Jeroen Engels
b359fb3023 Add Lint.Rule.withDeclarationListVisitor function 2019-09-15 01:29:26 +02:00
Jeroen Engels
bf1f1d2380 Fix "across" typo accross the whole project 2019-08-29 22:45:28 +02:00
Jeroen Engels
011a205b13 Remove rules from the package 2019-08-28 08:36:24 +02:00
Jeroen Engels
ddaea22eab Move range manipulations fns out of Lint.Fix and into the rule that uses them 2019-08-22 19:48:46 +02:00
Jeroen Engels
5433526b2f Explain why we require providing the fix result in test error messages 2019-08-22 11:57:14 +02:00
Jeroen Engels
2c38878a6d Autofix all unused variables in NoUnusedVariables 2019-08-19 16:13:45 +02:00
Jeroen Engels
8fa510458e Fail applying a fix if ranges of the fixes overlap 2019-08-18 23:32:30 +02:00
Jeroen Engels
50f631c47c Add commented out tests for rangeUpUntil 2019-08-09 19:16:23 +02:00
Jeroen Engels
55fb6b71bb Improve NoUnusedVariables handles deleting the last declaration in a let in 2019-08-09 19:07:06 +02:00
Jeroen Engels
3b93133ada Fail applying a fix if the result becomes unparsable 2019-08-08 22:01:44 +02:00
Jeroen Engels
b7bbaff013 Fail the test with a helpful error message when fix does not change anything 2019-08-08 22:01:44 +02:00
Jeroen Engels
919467fee6 Add a way to check in tests that the fixed code is correct 2019-08-06 09:31:57 +02:00
Jeroen Engels
4eb024ef2e Make Lint.Fix.fix return a value that shows whether it was successful 2019-08-06 09:31:57 +02:00
Jeroen Engels
9e6160f8a6 Add ability to fix something on multiple lines 2019-08-06 09:31:57 +02:00
Jeroen Engels
76f0a8aaf2 Add tests for applying multiple fixes on a file 2019-08-06 09:31:57 +02:00
Jeroen Engels
330b1a1a7b Add tests for applying fixes on a single line 2019-08-06 09:31:57 +02:00
Jeroen Engels
d20396773e Move mergeRanges to Lint.Fix
Also add tests and documentation
2019-08-04 11:43:08 +02:00
Jeroen Engels
00215346ca Fix a bunch of typos about "it's" 2019-07-28 17:37:21 +02:00
Jeroen Engels
061fca8274 Check that the details are correct 2019-07-28 10:27:46 +02:00
Jeroen Engels
e27ea65b1a Add details in tests 2019-07-28 10:27:46 +02:00
Jeroen Engels
d593bae052 Add details to the message of every rule
This will make it easier to have helpful explanations and suggestions
like the Elm compiler does
2019-07-28 10:27:46 +02:00
Jeroen Engels
18a8514073 Show an example with Debug.todo rather than Debug.crash in NoDebug
Debug.crash has been removed in 0.19, and replaced by Debug.todo
2019-07-28 10:27:46 +02:00
Jeroen Engels
1cec4abc7f Rename module name in tests cases
Since the module name and the type were often the same, this should help 
remove some potential confusion
2019-07-25 11:16:54 +02:00
Jeroen Engels
45a10ebb3a Report unused import aliases that are named like a type 2019-07-25 10:40:23 +02:00
Jeroen Engels
527ee1c43a Report unused import aliases 2019-07-25 09:14:33 +02:00
Jeroen Engels
78562d1de5 Detect used types in pattern matching patterns 2019-07-25 00:19:43 +02:00
Jeroen Engels
2800e084e9 Organize the NoUnusedVariable rule tests 2019-07-24 18:58:56 +02:00
Jeroen Engels
7dc2094ff8 Reword the error message for the NoDebug rule 2019-07-23 00:16:02 +02:00
Jeroen Engels
6486148d25 Run missing locationIsAmbiguousInSourceCode test 2019-07-13 10:09:08 +02:00
Jeroen Engels
b829ab4f63 Lint.Test: Make error messgae formatting more consistent 2019-07-13 10:03:59 +02:00
Jeroen Engels
685e7dd6e1 Simplify the language used in Test error messages 2019-07-13 10:03:59 +02:00
Jeroen Engels
996c3039d6 Limit all Lint.Test error messages to 76 characters
This is so that they fit nicely in the terminal. The limit is usually 80
characters, but elm-test prepends every line by 4 spaces.
2019-07-13 10:03:58 +02:00
Jeroen Engels
905a74f901 Lint.Test: Add an identifiable name to errors to quickly be able to know what the problem is 2019-07-13 10:03:32 +02:00
Jeroen Engels
b6464dbff2 Move error messages out of Lint.Test and into Lint.Test.ErrorMessage 2019-07-11 08:47:33 +02:00
Jeroen Engels
1d3333f489 Add tests for the Test error messages 2019-07-11 08:47:33 +02:00
Jeroen Engels
6f26e13714 Remove rule DefaultPatternPosition
The compiler now forbids redundant patterns 👍
2019-07-08 22:23:27 +02:00
Jeroen Engels
2627b176df NoDebug: Forbid the import of the Debug module 2019-07-05 01:56:49 +02:00
Jeroen Engels
d576423905 NoDebug: Do not report when doing something like SomeModel.Debug.log 2019-07-05 01:56:49 +02:00
Jeroen Engels
3f6cc7c3e7 Add rule NoUnusedTypeConstructors 2019-07-05 01:21:30 +02:00
Jeroen Engels
fd6d142265 NoUnusedVariables: Do not report custom types for which a constructor was used 2019-07-05 00:33:51 +02:00
Jeroen Engels
396aa96c1f Remove comment about reporting unused pattern matching variables. This should be a new rule or option 2019-07-03 14:22:05 +02:00
Jeroen Engels
b236f10b5f Sort errors by position in the source code 2019-07-03 14:22:05 +02:00
Jeroen Engels
74c3c21bea NoUnusedVariables: Do not report types used in type signatures in a let in declaration 2019-07-02 11:55:49 +02:00
Jeroen Engels
c9a2a8e565 NoUnusedVariables: Do not report types used as arguments in custom types, or in type aliases 2019-07-02 11:42:07 +02:00
Jeroen Engels
b1b2a31e48 NoUnusedVariables: Do not report variables modified in a record update expression 2019-07-02 11:16:03 +02:00
Jeroen Engels
003336a735 Replace Lint.Test by the it's new version 2019-07-02 00:08:10 +02:00
Jeroen Engels
bf5a7dad8b Use new test module and improved the range for DefaultPatternPosition 2019-07-02 00:05:10 +02:00
Jeroen Engels
40cd398e35 Improve the range for NoExtraBooleanComparison 2019-07-02 00:05:10 +02:00
Jeroen Engels
e96b6610b2 Use new test module for NoExtraBooleanComparison 2019-07-02 00:05:10 +02:00
Jeroen Engels
75931b0f23 Use new test module for NoUnusedVariables 2019-07-02 00:05:10 +02:00
Jeroen Engels
8ffb30c450 Use new test module for NoDebug 2019-07-02 00:05:10 +02:00
Jeroen Engels
98d88e691e Use new test module for NoImportingEverything 2019-07-02 00:05:10 +02:00
Jeroen Engels
75e80d0926 Rewrite the Lint.Test module to have a nicer API and much better error messages 2019-07-02 00:05:10 +02:00
Jeroen Engels
9473c123bb Rename Lint.Test's "ruleTester" to "run" 2019-06-28 00:03:07 +02:00
Jeroen Engels
c3ceccc3dd Move Error to Lint.Rule 2019-06-28 00:03:07 +02:00
Jeroen Engels
5d465d8e95 Move TestUtil to Lint.Test and expose it in the package 2019-06-28 00:03:07 +02:00
Jeroen Engels
fbbb70749b Move LintResult from Lint.Error to TestUtil 2019-06-26 11:51:48 +02:00
Jeroen Engels
d23ba4a0a5 Move Rule definition to Lint.Rule 2019-06-25 23:51:43 +02:00
Jeroen Engels
692ebf2406 Simplify DefaultPatternPosition's configuration 2019-06-25 23:51:43 +02:00
Jeroen Engels
9923ec0368 Use new Rule API in existing rules 2019-06-24 00:52:23 +02:00
Jeroen Engels
76f63ff1f6 Refactor: Move LintResult to Lint.Error 2019-06-24 00:49:58 +02:00
Jeroen Engels
bf8c6a4b76 Add rule NoExtraBooleanComparison 2019-06-24 00:49:58 +02:00
Jeroen Engels
79885adde6 Add utilities to test rules 2019-06-24 00:49:58 +02:00
Jeroen Engels
3162a8bb68 Remove the need to specify error names when creating an error 2019-06-24 00:49:58 +02:00
Jeroen Engels
ede98bc179 Re-add DefaultPatternPosition 2019-06-08 23:12:55 +02:00
Jeroen Engels
21411aaf8c Re-add NoImportingEverything 2019-06-03 00:30:24 +02:00
Jeroen Engels
f6683e204d Improve tests 2019-06-02 23:06:08 +02:00
Jeroen Engels
95f4989fa9 Naming 2019-06-02 23:06:08 +02:00
Jeroen Engels
d204c21772 Handle ports 2019-06-02 23:06:08 +02:00
Jeroen Engels
7689d01304 Naming 2019-06-02 23:06:08 +02:00
Jeroen Engels
245b22455d import 2019-06-02 23:06:08 +02:00
Jeroen Engels
d656046936 report imports 2019-06-02 23:06:08 +02:00
Jeroen Engels
e28bd30490 nounused 2019-06-02 23:06:08 +02:00
Jeroen Engels
06d6e5f247 Add NoUnusedVariables rule 2019-06-02 23:06:08 +02:00
Jeroen Engels
d93474a62e Stop exposing parseSouce 2018-11-11 16:11:45 +01:00
Jeroen Engels
5236dea4d7 Module renaming 2018-11-11 00:10:35 +01:00
Jeroen Engels
c559bd94b8 Modules reordering 2018-11-10 23:38:12 +01:00