SetReplace
SetReplace copied to clipboard
Linter
The code consistency is currently somewhat out of whack. Tabs and spaces are used inconsistently, indentation is different, the line width is not enforced, etc.
We need a linter that would work along with CI and if not automatically fix then at least detect issues with code style and consistency.
Some lint tests we might want are:
- [ ]
Flatten
/ReplaceAll
/Thread
used without an explicit level spec (might need a different mechanism forThread
). - [ ]
Module
/With
/Block
:- Missing definitions;
- Unused definitions.
- [ ] Static WL code analysis
- [ ] Spacing issues
- Enforce line width;
- Check there are no tabs;
- No spaces at the end of files;
- No more than 2 spaces in between characters (unless followed by a comment);
- No more than 2 empty lines at a time;
- Empty lines present at the end of files.
- [ ] Wolfram Language code formatting
- Indentation;
- Check there are either always or never semicolons at the end of definitions.
- [ ] Check for broken links
- [ ] Tools from
GeneralUtilities`
:-
FindDeadCode
.
-
Linters we need:
- [x] C++
- [ ] Wolfram Language #575
- [x] Markdown #449
- [ ] English
- [x] Bash
If we incorporate macros like ModuleScope
(see https://github.com/maxitg/SetReplace/pull/461) then we should detect buried macros in the linter itself, since they don't evaluate properly (they do actually evaluate, but at runtime, which is quite slow).
May be relevant: https://github.com/WolframResearch/codeinspector
Formatter: https://github.com/WolframResearch/codeformatter