Bike shed :slightly_smiling_face: Any suggestions ...
# development
h
Bike shed 🙂 Any suggestions on what to call a linter provided by Pants that does regex string validation on your source code? For example, it can check for copy-right headers in each file. Currently, this is called the
validate
goal, but I'm merging that goal into
lint
Some ideas: •
sourcefile-validation
regex-validator
c
• spack also has this in its "style" command, which does linting • regex-validator seems like it better describes what this does separate from the more general lint goal i like the idea of checking copyright being given its own name but if it can also be configured to do arbitrary regex then i think regex-validator is appropriate since it lets people know how to use it
h
Awesome! I like
regex-validator
a lot too. Indeed, it can be used for any arbitrary regex
c
I’m not too sold on the
regex-validator
name, feels like its purpose is to validate regex’es.
sourcefile-validation
is a bit cumbersome, but more to the point, imo.
assert-patterns
.. ? I’m unable to come up with something I feel strongly for, so.. either way, I guess for me 🙂
👍 1
p
I’m not sure about the goal name, but this regex thing sounds cool. This might allow StackStorm to get rid of a custom flake8 plugin that validates licenses.
🎉 1
💯 1
h
Re
assert-patterns
, I think we probably want a noun because it's going to show up in messages like
Copy code
Flake8 succeeded
regex-validator failed
But it could be
pattern-checker
for example
p
The
do-that-thinger
succeeded…
🧌
regextioneer
😁 2
c
right, so
lint
is the verb..
so
regex-patterns
.. ?
or even
regex-validation
🙂
b
Isn't the fact that it uses a regex just an implementation detail? 🤔
h
Isn't the fact that it uses a regex just an implementation detail?
I don't think so because you provide the regexes yourself. This is Pants's config for what is currently the
validate
goal:
Copy code
path_patterns:
  - name: python_source
    pattern: (?<!__init__)\.py$
  - name: rust_source
    pattern: .*.rs$
  - name: build_files
    pattern: /BUILD(?:\..*)?$

content_patterns:
    - name: python_header
      pattern: |+
        ^(?:#\!\/usr\/bin\/env python3
        )?# Copyright 20\d\d Pants project contributors \(see CONTRIBUTORS.md\)\.
        # Licensed under the Apache License, Version 2.0 \(see LICENSE\)\.
    - name: rust_header
      pattern: |+
        ^// Copyright 20\d\d Pants project contributors \(see CONTRIBUTORS.md\)\.
        // Licensed under the Apache License, Version 2.0 \(see LICENSE\)\.

required_matches:
  python_source:
    - python_header
# TODO: Make rust code conform, then uncomment this.
#  rust_source:
#    - rust_header
  build_files:
    - python_header
h
relint
?
c
I think Joshua has a good point. Say that we want to validate patterns, and regex is one class of patterns we can use. Possibly the only class, for the time being, but there could potentially be others.. but that may very well be pre-optimization..
h
If we want others, we could also add
alternative-to-regex-validator
or so on. I suspect it would be cleaner to keep them separate. (And that's part of my motivation for merging
validate
goal into just one of many
lint
implementations)
👍 1
Benjy, how about
regex-lint
or
regex-linter
? I don't love the ambiguity of what "re" means
Overall, I like
regex-linter
>
regex-validator
, given that it's the
lint
goal 😉
b
@hundreds-father-404 Python already stepped on that one for you 😉
import re
Also, since we're bikeshedding
regex-linter
looks like it lints regexes
🤔 1
👍 3
c
lint-patterns
?
b
file-contents-pattern-matcher
really just eat those columns up
😂 2
h
regex-lint
?
👍 1
pattern-matcher
?
☝️ 1
👍 1
b
filestamp
if you want to just use a more nebulus name
h
@bitter-ability-32190 does
regex-lint
also sound like it's linting regex? I see why
regex-linter
sounds like that, but this feels different to me
b
........ maybe? But less so? That's odd 🤔
...odd that it feel less like its linting regexes. English is weird
💯 1
Ultimately though this is a bikeshed 😉
🚲 1
🏠 1
c
I agree,
regex-lint
works
1
b
regex-filelint
some part of me itches for
file
h
That makes me wonder
file
vs what, directories? I think
regex-lint
seems to work well. Thanks all for participating in the bike shed of the week 😅
🙃 2
c
That makes me wonder 
file
 vs what, directories?
I think vs “regex’es”.. makes it very clear it is not regex patterns being linted..
but then
regex-filelinter
would work too.. (I prefer
regex-lint
though, it is more succinct)
👍 1