mmozuras / poper

Make sure git commit messages are well-formed
MIT License
77 stars 11 forks source link

Add warning level to configuration options #9

Open npetkov opened 7 years ago

npetkov commented 7 years ago

It's great that poper now supports external config files. I have a hopefully simple feature request - could you please make the warning level of the messages configurable as well? This is desirable in cases where ill-formatted commit messages have already slipped upstream and would break CI builds configured with pronto's exit-code option.

ivanovaleksey commented 7 years ago

@npetkov could you provide some example? You can specify how much commits you want to run a check on.

npetkov commented 7 years ago

Yes, I'll try to clarify what I mean. Consider the check method. It returns an array of objects:

OpenStruct.new(commit: commit.oid, message: result) if result

So essentially, every "error" returned from poper will have a commit and message field. I think it would be useful if another field is added, called :level (in line with pronto naming), which is globally configurable via the configuration file:

OpenStruct.new(commit: commit.oid, message: result, level: [this should be configurable]) if result

This configurable "severity" is useful for certain cases where "non-compliant" commit messages (like merge commits) are unavoidable.

Of course, this would require a change in the poper-runner main method as well, but this is a matter of another issue:

def message_for(error)
  Message.new(nil, nil, error.level, error.message.capitalize, error.commit, self.class)
end

I hope this makes more sense now.