Re: dub lint

2022-09-16 Thread Christian Köstlin via Digitalmars-d-learn

On 16.09.22 02:23, rikki cattermole wrote:


https://github.com/dlang/dub/issues/2483
Also the double --config option is already in a bugreport (quite old), 
but not fixed as far as i can see:

https://github.com/dlang/dub/issues/1940

Kind regards,
Christian




Re: dub lint

2022-09-15 Thread rikki cattermole via Digitalmars-d-learn



https://github.com/dlang/dub/issues/2483


Re: dub lint

2022-09-15 Thread Christian Köstlin via Digitalmars-d-learn

On 16.09.22 01:14, Christian Köstlin wrote:

On 16.09.22 00:14, Ali Çehreli wrote:

On 9/15/22 15:04, Ali Çehreli wrote:

 > Is there a way to silence specific 'dub lint' warnings?

Answering myself, I don't think it's possible but luckily my catching 
an Error was in unittests only so I can do either of the following to 
skip unittest code when linting:


a) Pass --skipTests to dscanner (what 'dub lint' runs behind the 
scenes) along with --styleCheck, which --skipTests requires


   dub lint -- --skipTests --styleCheck

b) Pass --styleCheck indirectly through 'dub lint', which has its own 
spelling for it :), but --skipTests is still required of course:


   dub lint --style-check -- --skipTests

Ali

There is `dub run dscanner -- --defaultConfig` which creates a default 
config in `~/.config/dscanner/dscanner.ini` (for linux and osx). There 
one can disable only the checks for bad exception handling

```
; Check for poor exception handling practices
exception_check="disabled"
```
and then its possible to move this file e.g. to the project folder and 
use in with `dub lint --config=dscanner.ini` ...

interestingly `dub lint --help` shows two different options for `--config`:

```
dub lint --help
USAGE: dub lint [[@]] [] [-- 
]

..
..
   --config=VALUE    Use the given configuration file.
..
..
   -c  --config=VALUE    Builds the specified configuration.
..
..

```

Kind regards,
Christian
p.s. phobos for example includes its own dscanner.ini file in 
https://github.com/dlang/phobos/blob/master/.dscanner.ini







Re: dub lint

2022-09-15 Thread Ali Çehreli via Digitalmars-d-learn

On 9/15/22 16:14, Christian Köstlin wrote:

> There is `dub run dscanner -- --defaultConfig` which creates a default
> config in `~/.config/dscanner/dscanner.ini` (for linux and osx).

Thanks! I love such features. It is so useful for a program to write out 
its configuration file. (My tools did that too.)


> interestingly `dub lint --help` shows two different options for 
`--config`:

>
> ```
> dub lint --help
> USAGE: dub lint [[@]] [] [--
> ]
> ..
> ..
>--config=VALUEUse the given configuration file.
> ..
> ..
>-c  --config=VALUEBuilds the specified configuration.

Neither of which is obvious to the newcommer at all. Not one bit! Even 
though I knew dscanner was the program 'dub lint' uses (perhaps because 
I noticed the message as it was being installed?) I did not think even 
once that 'dub lint's --config would refer to 'dscanner's config.


As a dub user, I wouldn't know to go to a random program's web site. 
Even 'dub lint' doesn't mention dscanner: 
https://dub.pm/commandline.html#lint


Ali



Re: dub lint

2022-09-15 Thread Christian Köstlin via Digitalmars-d-learn

On 16.09.22 00:14, Ali Çehreli wrote:

On 9/15/22 15:04, Ali Çehreli wrote:

 > Is there a way to silence specific 'dub lint' warnings?

Answering myself, I don't think it's possible but luckily my catching an 
Error was in unittests only so I can do either of the following to skip 
unittest code when linting:


a) Pass --skipTests to dscanner (what 'dub lint' runs behind the scenes) 
along with --styleCheck, which --skipTests requires


   dub lint -- --skipTests --styleCheck

b) Pass --styleCheck indirectly through 'dub lint', which has its own 
spelling for it :), but --skipTests is still required of course:


   dub lint --style-check -- --skipTests

Ali

There is `dub run dscanner -- --defaultConfig` which creates a default 
config in `~/.config/dscanner/dscanner.ini` (for linux and osx). There 
one can disable only the checks for bad exception handling

```
; Check for poor exception handling practices
exception_check="disabled"
```
and then its possible to move this file e.g. to the project folder and 
use in with `dub lint --config=dscanner.ini` ...

interestingly `dub lint --help` shows two different options for `--config`:

```
dub lint --help
USAGE: dub lint [[@]] [] [-- 
]

..
..
  --config=VALUEUse the given configuration file.
..
..
  -c  --config=VALUEBuilds the specified configuration.
..
..

```

Kind regards,
Christian




Re: dub lint

2022-09-15 Thread Ali Çehreli via Digitalmars-d-learn

On 9/15/22 15:04, Ali Çehreli wrote:

> Is there a way to silence specific 'dub lint' warnings?

Answering myself, I don't think it's possible but luckily my catching an 
Error was in unittests only so I can do either of the following to skip 
unittest code when linting:


a) Pass --skipTests to dscanner (what 'dub lint' runs behind the scenes) 
along with --styleCheck, which --skipTests requires


  dub lint -- --skipTests --styleCheck

b) Pass --styleCheck indirectly through 'dub lint', which has its own 
spelling for it :), but --skipTests is still required of course:


  dub lint --style-check -- --skipTests

Ali



Re: dub lint

2022-09-15 Thread Ali Çehreli via Digitalmars-d-learn

On 9/15/22 14:32, Ali Çehreli wrote:

> (However, like all linters it's not perfect but I still like having that
> power.)

The following code is flagged because it catches Error:

unittest
{
try
{
assert(false);
}
catch (Error)
{
// Cool...
}
}

[warn]: Catching Error or Throwable is almost always a bad idea.

Is there a way to silence specific 'dub lint' warnings? For example, the 
code above is actually similar to assertThrown!Error, which knows what 
it's doing. :)


  https://dub.pm/commandline.html#lint

Ali



dub lint

2022-09-15 Thread Ali Çehreli via Digitalmars-d-learn
I've always thought of dub as a package manager and a build tool. But it 
actually makes it easy to use other tools:


- dub lint: Runs some checks on your project. What I liked is how it 
removed the need to figure out how to install dscanner, which it uses 
behind the scenes. It installed dscanner and simply ran it. Cool... 
(However, like all linters it's not perfect but I still like having that 
power.)


- dub dustmite: I haven't actually tried this but dub's help with using 
dusmite sounds great.


Ali