martin-helmich / typo3-typoscript-lint

Find coding errors in your TypoScript files.
MIT License
82 stars 19 forks source link

Fails when directory specified in paths doesn't exist #58

Closed mikestreety closed 5 years ago

mikestreety commented 6 years ago

Hi,

Sorry for the abundance of issues I'm raising. If I knew more about this stuff I would try and help out! I really appreciate this linting tool, it's great. Thank you.

I've just set it up to use internally for all our projects and the task shares a common rule file (specified with the --config flag) as they all follow the same conventions.

I have just noticed that if the project doesn't have a directory specified in the paths array, that the whole task fails:

In Finder.php line 547:

  The "" directory does not exist.  

Is there anyway we can get it to just skip over this? Thanks 👍

martin-helmich commented 6 years ago

:+1: Thanks for the report, and sorry for the late response. I'm having trouble reproducing this issue, though. Could you share your config file?

mikestreety commented 6 years ago

THanks for getting back to me.

I am running the command like this:

typoscript-lint \
    --config=./ci/jobs/ts-lint/rules-tslint.yml \
    --fail-on-warnings \
    --ansi

And my config is this:

filePatterns:
  - "*.ts"

paths:
  - "./build"
  - "./public_html/typo3conf/ext"

sniffs:
    - class: Indentation
      parameters:
          indentPerLevel: 2
          indentConditions: true

    - class: RepeatingRValue
      disabled: true

    - class: NestingConsistency
      disabled: true
      parameters:
          commonPathPrefixThreshold: 5

Our build folder structure is build/[client]/ts/file.ts. Most setups will have one client, but a few have many. The error above is generated when the public_html/tyopo3conf/ext folder doesn't exist which new sites (or sites not needing extension) do not have.

martin-helmich commented 5 years ago

Took me a while to get back to this; sorry for the delay. I thing that #67 might fix your issue.