Giter VIP home page Giter VIP logo

Comments (4)

PaulRBerg avatar PaulRBerg commented on June 23, 2024 1

Foundry considers only public or external functions tests, so I agree about the public qualifier.

I agree that the best way to add support for this rule would be to be able to nested Solhint configurations in folders, but I would smile upon having one of the interim solutions you mentioned (e.g. .solhint.test.json).

from solhint.

dbale-altoros avatar dbale-altoros commented on June 23, 2024

@PaulRBerg you mean a rule to do what ?
check that the prefix of any function is with one of those for testing ?

from solhint.

PaulRBerg avatar PaulRBerg commented on June 23, 2024

check that the prefix of any function is with one of those for testing ?

Yes. A rule that would activate the regex above.

from solhint.

fvictorio avatar fvictorio commented on June 23, 2024

Some thoughts on this.

First, I guess the behavior of the new rule should be: "If a (public?) function starts with test, then check that it follows the naming convention". Not sure about the public part, but I guess it makes sense.

Second, having some way to only apply the rule for files in a given directory makes a lot of sense, but I'm not sure what's the best way to accomplish it. Possible solutions:

  1. The best way IMO would be to have a separate .solhint.json file inside the test directory, that extends the config file in the parent directory. This is a useful pattern, and the way this is done in eslint-land. But I'm pretty sure that solhint doesn't support this (it should).
  2. Alternatively, the rule could have a testDirectory option, or something like that. Since I think the previous alternative is way better (and useful in other contexts), I believe adding this option would eventually become dead weight. But it's certainly the easiest way to accomplish this. Idk.

A middle ground would be this: have two solhint files .solhint.json and .solhint-tests.json, and make the second one extend the first (this is also not supported, but it's easier to do). Then have two npm scripts: lint and lint-tests (or whatever) and make the second one explicitly use the second config file and the tests directory.

from solhint.

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.