Git Product home page Git Product logo

Comments (5)

sds avatar sds commented on June 20, 2024

The way haml-lint does this is by creating a temporary file in the same directory as the original .haml file being linted. This results in rubocop automatically using the correct configuration.

Is there any possibility you could do the same? I would rather not include a hack for a specific linter if it can be avoided.

from haml-lint.

jschroeder9000 avatar jschroeder9000 commented on June 20, 2024

Thank you for the response.

My package is very simple and I feel a bit like I'm standing with one leg each on the shoulders of two giants (haml-lint and atom's linter), delicately pointing them both in the right direction. :)

The behavior of linter to write files to /tmp is quite deeply ingrained and not configurable. While I can't speak for the intent of the authors, I suspect it may be intentional. Node's tempfile utilities do not have the magic of ruby's TempFile class where the tempfile gets cleaned up with garbage collection pretty much no matter what. By writing to /tmp, no garbage is left behind within the source code in the event of the unexpected, e.g. if the editor crashes.

I'm much more familiar with ruby than node, so this is the natural direction for me to turn first. It seems like the fact that Rubocop::CLI#run accepts overriding ARGV is a boon for HamlLint::CLI to accept a separate option for the location of .rubocop.yml and pass it through in a straight-forward manner.

I know it feels like a bit of a kludge to have two options for config files and this is definitely an edge case, but there are two separate linters at play here. Would you be willing to entertain a pull request that does what I have described?

from haml-lint.

sds avatar sds commented on June 20, 2024

One last question: is it possible for you to set an environment variable before executing haml-lint?

Rather than expose a flag on the command-line (and having to maintain code that passes that all the way through to the linter), I'd be more comfortable with an environment variable (something like HAML_LINT_RUBOCOP_CONF) that the RuboCop linter can recognize and pass on as a flag to Rubocop::CLI#run.

This would allow the code to only exist in the RuboCop linter, maintaining isolation from the rest of the system.

from haml-lint.

jschroeder9000 avatar jschroeder9000 commented on June 20, 2024

Setting an environment variable is definitely doable, I have submitted a pull request to linter to support it.

from haml-lint.

sds avatar sds commented on June 20, 2024

Closing as this seems to have lost steam. Feel free to reopen when this is ready to pursue again.

from haml-lint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.