Coder Social home page Coder Social logo

git-precommit-checks's People

Contributors

dependabot[bot] avatar mbrehin avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

git-precommit-checks's Issues

Add asciinema demo

Because asciinema cannot be embed on README.md a PNG has to be extraced and linked to the asciinema.com recording.

Add unit tests on utility functions

  • Setup test runner (Jest? Chai?)
  • Add tests on index.js:
    • parseContents(…)
  • Add tests on lib/utils.js:
    • regexFromStr(regex)
    • colorizedLog(logLevel, text) ?
    • colorizedLogTitle(logLevel, hookTitle, text) ?
    • printErrors(severity, errors, hookTitle) ?

Feature : manage external configuration

Because we won't always want to group configuration in package.json we must provide an alternative.

Instead of expecting a static alternative (ie. git-precommit-checks.rc), we'd like to use a --config option that would allow configuration to be loaded from where we want.

Docs: add README.md

Write default README.md with expected behavior and configuration options.

Rule with "nonBlocking": "false"

Hello,

The following rule :
{
"filter": "\.js$",
"message": "You’ve got leftover console.log",
"regex": "console\.log",
"nonBlocking": "false"
}
Create the commit. I must remove attribut "nonBlocking" to forbid the creation of the commit.

when there is no configuration, the error message should be more explicit

When there is no configuration, the error message should be more explicit than:

Pre-commit checks failed due to unexpected error. TypeError: Cannot destructure property patterns of 'undefined' or 'null'.
at run (/home/myuser/path/to/myproject/node_modules/git-precommit-checks/index.js:26:33)

I know configuring is already mentionned in the documentation, but the error message should be clearer.

Does node 10 really required?

Why you does not support current node LTS version, which is 8.9.0? I want use your project in enterprise environment and failed with it.

diff: prefix files path with POSIX double dash

Some people get an error like `fatal: … unknown revision or path not in the working tree'.

Using POSIX double dash to prefix files path when running diff command should prevent this.

Read config from other places

Hi,

That would be great if your project could read from other places than package.json.

I'm using Rush and I don't have root package.json file.

Maybe a .precommit-check.json or something similar would be good ?

Add contribution guideline

Create CONTRIBUTING.md describing project expectations:

  • automation
  • conventions (commits, releases…)
  • workflow?

Bug: manage large files

When running checks on large files, an error occurs:

Couldn’t run 'exec' command: RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded

This could be (temporarily) be bypassed using upcoming feature for excluded files/patterns #34.

Rule with "nonBlocking": "false"

Hello,

The following rule :
{
"filter": "\.js$",
"message": "You’ve got leftover console.log",
"regex": "console\.log",
"nonBlocking": "false"
}
Create the commit. I must remove attribut "nonBlocking" to forbid the creation of the commit.

WIP/Feature: manage auto-correct rules

Most of the time the patterns we're looking at code chunks that should be removed (or transformed?).

It would be great to have an auto-remove option per rule (I'm not quiet sure of option’s name).

Here is an example:

"git-precommit-checks": {
    "rules": [
      {
        "filter": "_spec\\.rb$",
        "message": "Your RSpec test suite is trimmed down by `focus` tags",
        "regex": "(?:,focus: true|:,focus => true)",
        "auto-remove": true,
      },
      {
        "filter": "\\.rb$",
        "message": "Your Ruby file seems to have an active `binding.pry` call",
        "regex": "(^[^#]*\\bbinding\\.pry)",
        "auto-remove": true,
      }
    ]
  }
…

This should remove matched pattern and auto-stage updates:

it 'has a valid kind', focus: true do => it 'has a valid kind' do

Filter does not work

Hi there!

I am trying to setup git-precommit-checks but the rule about FIXME|TODO does not work because of the filter.

If I remove the filter it works well, if I set it up the rule seems to be ignored.

I followed the docs and copy/pasted the filter but nothing happens.

Can you help me to find where I did it wrong?

My config:

"git-precommit-checks": {
		"display": {
			"offendingContent": true,
			"rulesSummary": true,
			"verbose": true,
			"shortStats": true
		},
		"rules": [
			{
				"nonBlocking": "true",
				"message": "You've got leftover `console.log`",
				"regex": "^(?!.*//).*console\\.log\\("
			},
			{
				"message": "You've got leftover conflict markers",
				"regex": "/^[<>|=]{4,}/m"
			},
			{
				"filter": "^package\\.json$",
				"message": "You have unfinished devs",
				"nonBlocking": "true",
				"regex": "/(?:FIXME|TODO)/i"
			}
		]
	},

Thank you in advance for your help!

Breaking change : load rules from `git-precommit-checks` scope instead of `hooks`

Because hooks is too generic and probably used by many other modules, we'd better load rules from a more specific scope.

This would be also easier to understand and search if it uses its own module name.

  • Load rules from git-precommit-checks
  • Add migration tool that checks for rules presence and also checks package.json version

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.