Commit Graph

234 Commits

Author SHA1 Message Date
lucica28 010ac1d3b7 replace libdparse in constructor check (#43) 2025-01-12 16:21:45 +02:00
lucica28 07f97fb4c5 replace libdparse in alias style visitor (#38) 2025-01-12 16:21:45 +02:00
lucica28 65720ab41f replace libdparse in explicitly annotated unittests check (#44) 2025-01-12 16:21:45 +02:00
lucica28 50e992c219 replace libdparse in length subtraction visitor (#42) 2025-01-12 16:21:44 +02:00
lucica28 bf0c847384 replace libdparse in redundant attributes visitor (#40) 2025-01-12 16:21:43 +02:00
lucica28 bb16676c98 replace libdparse in imports sortedness visitor (#35)
* replace libdparse in imports sortedness visitor

* minor refactor
2025-01-12 16:21:43 +02:00
lucica28 a3efa880e8 replace libparse in incorrect infinite range visitor (#33) 2025-01-12 16:21:43 +02:00
lucica28 c63616f1d4 replace libparse in final attribute visitor (#34) 2025-01-12 16:21:43 +02:00
lucica28 6ae996fea6 replace libdparse in delete check (#21)
* replace libdparse in delete check

* delete comment
2025-01-12 16:21:42 +02:00
lucica28 500f3b30ea replace libdparse in objectconst functionality + unittests integration with dmd (#17)
* replace libdparse in objectconst functionality + unittests integration with dmd

* updated dmd

* run tests

* use templates

* visit aggregate declaration

* updated dmd

* solve linter seg fault

* get rid of dup + refactor

* fix typo
2025-01-12 16:21:38 +02:00
Lucian Danescu acf6814258 Replace libdparse in enum array functionality 2025-01-12 16:21:34 +02:00
Eduard Staniloiu d39a9c4481 Fix linter errors 2025-01-12 16:20:19 +02:00
Eduard Staniloiu 3ee590bb50 Add style checker (#9) 2025-01-12 16:20:19 +02:00
Razvan Nitu d5b795cc56 Fix failing tester + add unittest for imports (#7) 2025-01-12 16:20:19 +02:00
lucica28 c9d07ebbf6 Removed libdparse from imports print functionality (#3) 2025-01-12 16:20:19 +02:00
Hiroki Noda 22c9f980ae Allow skipping checks for dscanner.suspicious.unmodified with nolint 2024-05-06 10:10:54 +02:00
Hiroki Noda 17f3286fef Clearify key names 2024-05-06 10:08:53 +02:00
ryuukk 433d1eb73e Print to stdout 2024-02-08 03:46:26 +01:00
SixthDot 9076f7bab3
docs(dscanner/utils): Update obsolete url in comment (#944)
Co-authored-by: Petar Kirov <petar.p.kirov@gmail.com>
2024-01-01 11:08:09 +02:00
Jeremy Baxter 01e90ec4d8 Fix build on BSD
Removed the line `SHELL:=/usr/bin/env bash'. Most BSDs don't ship bash in the
base system by default and the build doesn't need it anyway.

Also added some more version statements to define useXDG for the other BSDs.
2023-12-26 13:10:01 +01:00
WebFreak001 8612841365 fix compilation on old compilers 2023-10-25 08:49:37 +02:00
WebFreak001 42033dcc55 add BaseAnalyzerArguments to keep ctor changes sane
also immediately makes tokens a part of it

This struct can for example precompute token indices for line endings
2023-10-25 08:49:37 +02:00
ricardaxel 1e8f1ec9e6
Allow skipping checks with @("nolint(...)") and @nolint("...") (#936)
Co-authored-by: Axel Ricard <contact@axelricard.fr>
Co-authored-by: WebFreak001 <gh@webfreak.org>
2023-10-13 02:45:59 +02:00
Axel Ricard 69d824f4f7 introduce variable expandedArgs 2023-10-11 00:34:00 +02:00
Axel Ricard 3bf3f25f9a add --exclude cli option
This excludes given files or directory from linting
2023-10-11 00:34:00 +02:00
Axel Ricard 87f85c7db7 add some utils functions for path manipulation 2023-10-11 00:34:00 +02:00
Prajwal S N 159e9c9eec feat(highlight): support multiple themes
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2023-09-24 19:36:21 +02:00
Robert Schadek b43c8f45cf Always Check Curly
Check that if|else|for|foreach|while|do|try|catch
are always followed by a BlockStatement aka. { }

closer

can not get the test to work

try to get the AutoFix in place

maybe a fix

nicer messages

some formatting

more tinkering

still nothing

autofix work now

AutoFix name

message to message_postfix
2023-09-24 19:35:46 +02:00
WebFreak001 6491d792f5 support `@arguments.rst` for args through file 2023-09-24 15:31:50 +02:00
WebFreak001 a958f9ac7b fix unused variable check for unitthreaded checks
such as `a.should == b`
2023-07-17 14:41:07 +02:00
WebFreak001 c8262f4220 fix auto_function autofix for `auto ref fn()` 2023-07-17 11:32:16 +02:00
WebFreak001 f22b2e587c Disable auto_function_check by default
Since it may be used to auto-infer function attributes
2023-07-17 11:32:16 +02:00
WebFreak001 5d67707744 more sane parentheses fix for delegates
not sure what I was thinking with the initial version
2023-07-13 16:42:36 +02:00
WebFreak001 7601fe65f9 fix diagnostic location for `@UDA auto f() {}` 2023-07-10 22:05:26 +02:00
WebFreak001 c1e051bfba fix infinite allocating in context formatter 2023-07-10 13:57:27 +02:00
WebFreak001 48db254fb0 fix if scopes and shortened function bodies 2023-07-10 00:52:04 +02:00
WebFreak001 d275361153 fix case/default scopes, fix #913 2023-07-10 00:52:04 +02:00
Jan Jurzitza fed654441f
fix #916 autofix CLI, add integration test for it (#917) 2023-07-09 13:09:21 +02:00
Jan Jurzitza 4c759b072c
include resolved autofixes in `--report` output (#915) 2023-07-09 09:44:02 +02:00
WebFreak001 3345a1953a improve public auto fix API 2023-07-08 23:09:33 +02:00
WebFreak001 43caad72a8 add CLI API to get autofixes at location 2023-07-08 23:09:33 +02:00
WebFreak001 53c9536332 add startIndex, endIndex support to format string 2023-07-08 23:09:33 +02:00
WebFreak001 4194e6af0c add `dscanner fix` command 2023-07-08 23:09:33 +02:00
WebFreak001 48cec8a6f4 implement indentation aware autofixes 2023-07-08 23:09:33 +02:00
WebFreak001 93aae57469 add autofix testing API 2023-07-08 23:09:33 +02:00
WebFreak001 f12319d5a8 add autofix whitespace collapsing API 2023-07-08 23:09:33 +02:00
WebFreak001 513b7dafc3 add auto-fix API 2023-07-08 23:09:33 +02:00
Christian Köstlin 35d2cf4177 feature: Provide predefined error format compatible with dmds output
an output parser that works with dmd / ldc just works (tm) witha
dscanner as well
2023-07-07 00:15:04 +02:00
WebFreak001 1201a68f66 Only call Win32 API to enable colored output once 2023-07-05 22:41:42 +02:00
WebFreak001 a676bb13fb fix selective imports 2023-07-02 13:33:11 +02:00
WebFreak001 78f2b5a420 add colored output option
also adds a simpler way to invoke D-Scanner for users that uses this new
UI by default: `dscanner lint FILES...`
2023-07-02 13:33:11 +02:00
WebFreak001 146fec75d8 add index and endIndex to JSON formats 2023-06-29 17:43:30 +02:00
WebFreak001 b115a6333a also add byte indices to diagnostic ranges
For tools wanting to read from the source file this makes it much easier
to look up the code.
2023-06-29 17:43:30 +02:00
WebFreak001 bad253bad5 remove unused variables 2023-06-29 14:57:32 +02:00
WebFreak001 83eb9c5c2e add built-in report formats incl. GitHub Actions
use on ourself and enable unused variables test to do first test in CI
2023-06-29 14:57:32 +02:00
WebFreak001 5c2035ff76 add end line/column to warnings 2023-06-29 13:19:36 +02:00
WebFreak001 5a53c538d0 make mismatched args not warn on named arguments
makes expressions be assumed as valid argument names
2023-05-23 12:15:52 +02:00
WebFreak001 4b2124e82d upgrade libdparse to 0.23.0 2023-05-23 12:15:52 +02:00
WebFreak001 93f338a5e7 fix logger warnings, for real this time
We should probably add a linter case for this
2023-05-19 23:12:16 +02:00
WebFreak001 f37faf85dd fix BodyOnDisabledFuncsCheck edge cases 2023-05-09 04:10:43 +02:00
Mai-Lapyst e2cc6e1ad2 Adds an check for `@disable`d functions that have an body; closes #897 2023-05-09 04:10:43 +02:00
Jan Jurzitza 5f1cf31ee0
hide dsymbol warnings, fix #890 (#900) 2023-05-09 03:34:08 +02:00
brianush1 d0c670a415 fix static warnings and add tests for function_attribute_check 2023-05-09 02:19:42 +02:00
brianush1 ba4617efac add unittest for FunctionAttributeCheck 2023-05-09 02:19:42 +02:00
brianush1 14ba4af4bd fix #791 2023-05-09 02:19:42 +02:00
Su 9b171c46d2
don't use deprecated properties (#894) 2023-02-28 00:48:14 +01:00
WebFreak001 d5d6920502 Add dub.selections.json, upgrade libdparse 0.22.0
Note: currently a warning is emitted when building, because dscanner now
depends on libdparse 0.22.0, but dsymbol doesn't support it officially
yet. We just force it with dub.selections.json to build with 0.22.0 for
executable builds.
2023-02-15 12:10:33 +01:00
Zachary Yedidia 3437e30cac Add unit test 2023-01-31 23:32:52 -08:00
Zachary Yedidia 62297fdf7b Include aliasName in resolveSymbol 2023-01-31 23:29:25 -08:00
Zachary Yedidia 40235d3f9d
Fix noreturn discard warning (#887)
Fixes https://github.com/dlang-community/D-Scanner/issues/886
2023-01-31 22:16:48 +01:00
WebFreak001 2220812b96 Moved DSymbol into DCD 2022-10-14 14:30:10 +02:00
WebFreak001 e027965176 fix null pointer access in unused.d 2022-03-07 22:53:04 +01:00
WebFreak001 0316c9d70a fix libdparse deprecation in new check 2022-02-12 23:04:15 +01:00
WebFreak001 cdf881c103 add cyclomatic complexity check
Fix #684

Disabled by default.
2022-02-11 20:17:23 +01:00
WebFreak001 7f93ffaa1f add test that #499 is fixed 2022-02-02 21:31:28 +01:00
WebFreak001 631791e14d add tests for shortened function body extensions
Remove implementation in unused label (expressions can't have labels)
2022-02-02 21:02:29 +01:00
WebFreak001 a3fe7611a8 implement new ThrowExpression & shortened methods 2022-01-31 18:04:17 +01:00
Shigeki Karita 7c54e445c6 Add max_line_length config 2022-01-21 13:24:35 +01:00
Per Nordlöw 308bdfd1c1 Replace `std.typecons.scoped` with `scope` 2021-08-27 16:49:36 +09:00
Per Nordlöw 41d9682a5f Bump dsymbol to use branch use-gcallocator
Replace deprecated `body` with `do`

Bump dsymbol

Bump dsymbol
2021-08-27 16:49:36 +09:00
WebFreak001 7809598da0 fix if_constraints_indent with broken/null tokens
Subtraction from t.line (which is unsigned) caused the while loop
to run nearly infinitely before, starving the system of memory as it
was allocating memory.

fixes #829
2021-05-10 18:28:24 +00:00
Vladimir Panteleev e61ce45856
Add unused_result check 2020-08-25 06:26:31 +00:00
Hackerpilot 2174832e9f Fix tabs/spaces 2020-08-06 17:27:16 -07:00
Hackerpilot 3b590c377a Fix #815 2020-08-06 15:11:04 -07:00
Hackerpilot 0f37040b6f Fix the wording of the -I documentation 2020-07-17 01:23:18 -07:00
Hackerpilot b305f4fbfa Document some of the undocumented command-line switches 2020-07-16 18:38:59 -07:00
Hackerpilot 4bca597f4b Update the documentation for the local import rule 2020-06-22 22:18:12 -07:00
Hackerpilot 1bc03367b4 Disable the local imports check by default 2020-06-22 19:01:05 -07:00
andre2007 da64499c52 --reportFile added 2020-04-13 20:47:18 +02:00
H Paterson 064be72ee7
Fix imports
Because I'm rubbish at programming.
2020-03-21 18:58:07 +13:00
H Paterson 7f10a0598a
Fix find function
Use `canFind`, not `find` - which returns the post-string, not a boolean.
2020-03-21 18:56:58 +13:00
H Paterson 497a900f21
Exclude all hidden directories. 2020-03-21 18:52:00 +13:00
H Paterson 346d11f5e0
Exclude `.git` from search paths.
Currently dscanner searches for files in the target directory ending in `.d` or `.di`.

Git has some hidden files in `.git`, which log commits to files. These files share the same name as the tracked file: For example `.git/logs/refs/heads/somedfile.d` actually contains Git data, not D code.

A naive call to dscanner using `dscanner --syntaxCheck` or `dscanner --styleCheck` (therefore also `dub lint...`) will attempt to check these Git files, resulting in spurious errors, such as:
```sh
./.git/logs/refs/heads/charstream.d(1:1)[error]:
./.git/logs/refs/heads/charstream.d(1:118)[warn]: Line is longer than 120 characters
```

I believe Git is a common enough tool that we're justified to handle this case inside D scanner, rather than asking the user to write configuration files with dodge the `.git` folder.
2020-03-21 18:28:59 +13:00
MoonlightSentinel 00a0eedad5
Fix issue #794: False positive for parameter used in __traits(...)
This applies the already implemented solution for variables (#790) to
parameters by moving the __traits() logic in a new shared superclass.

It's explicitly excluded from UnusedIdentifier because I cannot think
of a good reason to silently allow unused labels.
2020-03-08 02:07:05 +01:00
MoonlightSentinel 4f417b64a1 Fix #788: Enum value used inside __traits(...) flagged as unused 2020-01-26 19:17:12 +01:00
MoonlightSentinel be5acfcae8 Fix empty error messages in issue 786
The message was assigned to Message.key and hence not printed.
2020-01-04 15:10:58 +01:00
Eugen Wissner 1d476fa39d Support checkName in errorFormat 2019-09-25 10:13:07 +03:00
Brian Schott d4dd5b9864
Merge pull request #773 from dlang-community/update-ctags-url
Fix the URL in the ctags output
2019-09-12 16:46:55 -07:00
Andre Pany 3b6bbad9fe Added reportFormat sonarQubeGenericIssueData 2019-09-11 12:53:26 +02:00
Hackerpilot 583fa7a898 Fix the URL in the ctags output 2019-08-23 11:19:23 -07:00