Commit Graph

234 Commits

Author SHA1 Message Date
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
Eugene Wissner 3b9d608866 Track check name for error messages (#769)
* Track check name for error messages

* Assert BaseAnalyzer.getName() is implemented
2019-07-09 12:16:25 +02:00
Frank LENORMAND 94d102a5f6 Document --errorFormat (#767)
* Document the "--errorFormat" in the usage message

* Document the "--errorFormat" in the README
2019-07-02 23:00:16 +02:00
Eugene Wissner 9502af2494 Split unused variable and unused parameter checks (#768) 2019-07-02 22:56:52 +02:00
Hiroki Noda e13c4f2f60 Use writeln instead of write to print the version (#764) 2019-06-03 09:34:17 +02:00
Basile-z 378cbcc6bd
fix #762 - False positive on "unused variable" with side effect (#763) 2019-05-29 11:11:03 +02:00
Sebastian Wilzbach 93418e3aa9 Fix #760 - ignore deprecated symbols in the undocumented check 2019-05-14 23:29:53 +02:00
Basile Burg 4499e559f0 final attrib check, prevent using an array to store the protection 2019-02-28 12:09:21 +01:00
Basile Burg 7850f30ec9 fix dscanner warning on non doc decl 2019-02-28 12:01:58 +01:00
Basile Burg 436a961934 Revert "ci, add codecov (#741)"
This reverts commit 0b84fc9b6b.
2019-01-03 03:05:03 +01:00
BBasile 0b84fc9b6b ci, add codecov (#741)
ci, add codecov
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
2019-01-02 16:23:18 +01:00
Nathan Sashihara 383fcb84d8 Fix byte order mark stripping (#740)
Fix byte order mark stripping
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
2019-01-01 11:13:09 +01:00
BBasile 9ef6d0aec1 fix - adaptation to correct DIP 1009 impl. was incomplete (#728)
fix - adaptation to correct DIP 1009 impl. was incomplete
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
2018-11-29 09:51:23 +01:00
BBasile 83c89ddc22 fix #721 - disable GC while scanning to prevent GC to dispose some AST members (#725)
fix #721 - disable GC while scanning to prevent GC to dispose some AST members
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
2018-11-29 08:41:08 +01:00
Basile Burg 8d3dcc55bc fix #723 - segfault when running D-Scanner master against dparse repo with -S 2018-11-27 14:40:12 +01:00
BBasile f585c383f1
update to dparse 0.10.x (#713) 2018-11-22 22:57:25 +01:00
Basile Burg aebb5b4a4c fix #696 - Unused variable fake positive with UFCS
Apparently it was a bug not only specific to the UFCS.
Now every use of the member access operator is handled.
2018-09-16 16:58:39 +02:00
WebFreak001 aeebbf85ae Fix #698 2018-09-13 16:42:21 +02:00
The Dlang Bot ed5bfe7269
Merge pull request #691 from BBasile/dparse-attrib-inloop
Update dparse to fix possible infinite loop and adapt to ParameterAttribute
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
2018-08-30 11:52:03 +02:00
Basile Burg 7494c5fb14 Update dparse to fix possible infinite loop and adapt to ParameterAttribute 2018-08-29 18:19:58 +02:00
BBasile 1b503656d4
Set the check for useless init disabled by default 2018-08-22 16:32:40 +02:00
Basile Burg f0000f4a01 fix #685 - Useless final attribute detects false positives 2018-08-14 10:43:59 +02:00
Basile Burg 99390ef872 fix #677 - Add support for expression-based contracts 2018-07-28 21:30:03 +02:00
The Dlang Bot 83fb251d73
Merge pull request #670 from wilzbach/githash-windows
Improve auto-versioning
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
2018-06-29 15:31:49 +02:00
Sebastian Wilzbach cd545d5090 Fix #671 - False positive in infinite range check 2018-06-25 23:45:13 +02:00
Sebastian Wilzbach d0a732113c Improve auto-versioning 2018-06-25 17:43:22 +02:00
Sebastian Wilzbach 103a327a60
Merge pull request #668 from BBasile/issue-665
fix #665 - The check for auto function without return doesn't handle "implicit auto functions"
2018-06-20 18:45:23 +02:00
Basile Burg af252569f7 fix #665 - The check for auto function without return doesn't handle "implicit auto functions" 2018-06-20 12:32:38 +02:00
Basile Burg a864eaafb7 fix #666 - False positive for "trust too much" 2018-06-20 12:08:39 +02:00
Basile Burg 727dd27662 Put the name of the variable which has a useless init between back ticks 2018-06-14 11:50:14 +02:00
The Dlang Bot 5a6101084f
Merge pull request #660 from BBasile/issue-659
fix #659 - has opEquals but not toHash warning even if opEquals is di…
merged-on-behalf-of: Brian Schott <Hackerpilot@users.noreply.github.com>
2018-06-12 21:53:59 +02:00
The Dlang Bot 40a0a9d9be
Merge pull request #661 from BBasile/issue-658
fix #658 - warning about non-const should not be emitted if the metho…
merged-on-behalf-of: Brian Schott <Hackerpilot@users.noreply.github.com>
2018-06-12 21:53:03 +02:00
Basile Burg aaf06fd500 fix #658 - warning about non-const should not be emitted if the methods are `@disable` 2018-06-12 11:18:55 +02:00
Basile Burg b5597e6bb6 fix #659 - has opEquals but not toHash warning even if opEquals is disabled 2018-06-12 11:10:06 +02:00
The Dlang Bot 32dd411ab5
Merge pull request #657 from BBasile/issue-656
fix #656 - Crash due to unsafe access in infinite range check
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
2018-06-08 13:41:47 +02:00
Basile Burg c51dcd98a7 fix #656 - Crash due to unsafe access in infinite range check 2018-06-08 12:34:04 +02:00
Sebastian Wilzbach 3430b0cab9 Fix #648 - Use the current git version when building the Windows binaries 2018-06-04 23:11:33 +02:00
Basile Burg f78d3e72b9 fix #645 - False positive, Else branch identical to Then branch with incomplete IfStatement 2018-06-02 05:57:43 +02:00
Brian Schott 2eb544cca3
Merge pull request #639 from BBasile/issue-635
fix #635 - Check for documented `throw` could also detect calls to `enforce`
2018-05-26 22:17:55 -07:00
Basile Burg a0010d6a8a fix tab and create routine for gen exception type 2018-05-25 23:37:50 +02:00
Basile Burg 1cd9e9f1ea fix #640 - Warning for variable used in ctor but not in standard func 2018-05-25 21:43:50 +02:00
Basile Burg aa7bdf81c6 fix #635 - Check for documented `throw` could also detect calls to `enforce` 2018-05-25 10:08:41 +02:00
Basile Burg d7af30bfb1 update version number 2018-05-22 11:55:17 +02:00
Basile Burg 6647caf8a1 fix #632, fix #633 - false positive for static and package methods in the check for virtual calls in constructors 2018-05-16 23:57:26 +02:00
Basile Burg 67a8257d7b update dependencies, fix some possible crash during linting
fixes are in dparse and previous dsymbol version didn't work with newest dparse so it's updated as well.
2018-05-14 16:37:59 +02:00
Basile Burg 5918497ed0 bump version number 2018-04-23 18:34:00 +02:00
The Dlang Bot fb76b59c89
Merge pull request #615 from BBasile/issue-610
fix #610 - False Negative For Missing Template Param In Ddoc
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
2018-04-23 10:39:27 +02:00
Basile Burg 8c44dd5092 Set all checkers class "final" 2018-04-22 20:33:58 +02:00
Basile Burg b737fc0c0f fix #610 - False Negative For Missing Template Param In Ddoc 2018-04-22 20:04:03 +02:00
Sebastian Wilzbach d96b48f765 Use git --describe tags as version string 2018-04-12 16:24:44 +02:00
BBasile b03adf1dff Change trust_too_much message which was slightly ambiguous (#611)
Change trust_too_much message which was slightly ambiguous
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
2018-04-12 10:38:19 +02:00
BBasile b17f271b74 fix #607 - Dscanner should warn about missing throws section in ddoc (#609)
fix #607 - Dscanner should warn about missing throws section in ddoc
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
2018-04-09 15:26:28 +02:00
Basile Burg 4231deb046 fix all cases of mixed tabs and spaces 2018-04-07 22:09:39 +02:00
The Dlang Bot af0bebd891
Merge pull request #605 from wilzbach/dub-valid-version
Generate a valid version for the DUB build
merged-on-behalf-of: Brian Schott <Hackerpilot@users.noreply.github.com>
2018-04-07 00:43:06 +02:00
The Dlang Bot 586a7ab262
Merge pull request #606 from wilzbach/fix-601
Fix #601 - dscanner should not complain about Params section when there's no ddoc
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
2018-04-06 13:38:47 +02:00
Sebastian Wilzbach 9aec2bc485 Fix #601 - dscanner should not complain about Params section when there's no ddoc 2018-04-06 13:20:15 +02:00
Sebastian Wilzbach 558c1bf6cf Fix #438 - check for __gshared and immutable redundancies 2018-04-06 10:46:21 +02:00
Sebastian Wilzbach 5bce2daa4a Generate a valid version for the DUB build 2018-04-06 10:44:19 +02:00
Basile Burg 6fe77da02d fix #575 - Dscanner should allow opCmp with no toHash 2018-04-05 10:47:14 +02:00
The Dlang Bot a4d84a0995
Merge pull request #594 from BBasile/issue-278
fix #278 - Weird: UTF-16LE encoding is unsupported
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
2018-04-05 07:14:33 +02:00
The Dlang Bot eafae0f6c0
Merge pull request #596 from BBasile/issue-195
fix #195 - Unrecognized CLI options gives huge stacktrace
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
2018-04-04 21:03:34 +02:00
Basile Burg 1a2352d17f fix #195 - Unrecognized CLI options gives huge stacktrace 2018-04-04 16:48:35 +02:00
Basile Burg 7014d54a3f fix spaces indentation 2018-04-04 16:43:59 +02:00
Basile Burg 6e7c366e49 fix #278 - Weird: UTF-16LE encoding is unsupported 2018-04-04 16:37:23 +02:00
The Dlang Bot a619e6bba0
Merge pull request #582 from wilzbach/window-config-file
Fix #268 - Use the User's profile directory under Windows
merged-on-behalf-of: Brian Schott <Hackerpilot@users.noreply.github.com>
2018-04-03 09:48:08 +02:00
The Dlang Bot 68a1fac12b
Merge pull request #586 from wilzbach/fix-583
Fix #583 - False negative for missing parameter in Params
merged-on-behalf-of: Brian Schott <Hackerpilot@users.noreply.github.com>
2018-04-03 09:46:11 +02:00
Brian Schott aae1c69c4a
Merge pull request #587 from wilzbach/config-dscanner
Don't use the dscanner prefix for the ModuleFilter in the config INI
2018-04-03 00:42:02 -07:00
Basile Burg 873c8f506a fix #588 - trust_too_much false positive with alias decl 2018-04-03 07:34:10 +02:00
Sebastian Wilzbach b9f5dbe22b Don't use the dscanner prefix for the ModuleFilter in the config INI 2018-04-03 06:49:46 +02:00
Sebastian Wilzbach 6ca45d8b3f Fix #583 - False negative for missing parameter in Params 2018-04-03 06:26:56 +02:00
Sebastian Wilzbach 75274faedb Fix #268 - Use the User's profile directory under Windows 2018-04-03 03:08:26 +02:00
BBasile cb31d2501e
add IZ safeAccess util and refactor several && chains with it (#577)
* add IZ safeAccess util and refactor several && chains with it

* show how to make inference working
2018-04-02 17:29:36 +02:00
BBasile 0e35538bbd Adds a check for too much trusted scope, close #545 (#581)
Adds a check for too much trusted scope, close #545
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
2018-04-02 07:48:20 +02:00
Basile Burg bed35ad9b8 remove help for non existing option 2018-03-31 00:51:21 +02:00
Basile Burg 67e0f8a9e4 Use new config name override instead of breaking existing ini 2018-03-30 23:59:36 +02:00
The Dlang Bot 8b52e513b9
Merge pull request #576 from wilzbach/has-public-examples-deprecated
Ignore has_public_example for deprecated symbols
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
2018-03-30 11:49:33 +02:00
Sebastian Wilzbach a8f4f71c46 Ignore has_public_example for deprecated symbols 2018-03-30 11:15:26 +02:00
Sebastian Wilzbach 06bc5323b7 Don't force the documentation of the template parameter if it's a used type in the parameter list 2018-03-28 16:12:34 +02:00
Sebastian Wilzbach 14ae261d55 Hot-fix for #570 (#572) 2018-03-24 20:24:39 +01:00
BBasile eb281030f5
Add a temporary function that warns or patches the old INI section (#570)
* Add a temporary function that warns or patches the old INI section

* fix tabs in help message
2018-03-23 16:03:40 +01:00
The Dlang Bot 9fa8756233
Merge pull request #450 from wilzbach/if_constraints_indent
Add check for if constraint indendation
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
2018-03-23 00:26:44 +01:00
Sebastian Wilzbach 27b09eebfd Check for function parameters in mixins (#484)
* Check for function parameters in mixins

* Don't trigger errors on uncertain mesages
2018-03-22 23:53:47 +01:00
Basile Burg e807bd7456 fix case of self linting failure 2018-03-22 23:50:03 +01:00
Sebastian Wilzbach cb073c3cf0 Add check for if constraint indendation 2018-03-22 21:03:10 +01:00
Laurent Tréguier 2be1a1f22f Move everything under package `dscanner` (#526)
* Move everything under package `dscanner`

* Fix .gitignore

* Fix .dscanner.ini
2018-03-22 20:15:42 +01:00