# Overcommit hook configuration for Teachable # see https://github.com/brigade/overcommit/blob/master/config/default.yml # for available options #------------------------------------------------------------------------------- # Loads Bundler context from a Gemfile. If false, does nothing (default). # (Generate lock file by running `bundle install --gemfile=.overcommit_gems.rb`) gemfile: ".overcommit_gems.rb" # Where to store hook plugins specific to a repository. These are loaded in # addition to the default hooks Overcommit comes with. The location is relative # to the root of the repository. plugin_directory: ".git_hooks" # Number of hooks that can be run concurrently. Typically this won"t need to be # adjusted, but if you know that some of your hooks themselves use multiple # processors you can lower this value accordingly. You can define # single-operator mathematical expressions, e.g. "%{processors} * 2", or # "%{processors} / 2". concurrency: "%{processors}" # Whether to check if a hook plugin has changed since Overcommit last ran it. # This is a defense mechanism when working with repositories which can contain # untrusted code (e.g. when you fetch a pull request from a third party). # See https://github.com/brigade/overcommit#security for more information. verify_signatures: false # Hooks that are run against every commit message after a user has written it. # These hooks are useful for enforcing policies on commit messages written for a # project. CommitMsg: ALL: requires_files: false quiet: false on_warn: :fail CapitalizedSubject: enabled: false description: "Check subject capitalization" EmptyMessage: enabled: true description: "Check for empty commit message" quiet: true HardTabs: enabled: false description: "Check for hard tabs" RussianNovel: enabled: true description: "Check length of commit message" quiet: true SingleLineSubject: enabled: true description: "Check subject line" TextWidth: enabled: true description: "Check text width" max_subject_width: 80 max_body_width: 72 TrailingPeriod: enabled: true description: "Check for trailing periods in subject" PresentImperativeTense: enabled: true description: "Check for present imperative tense" # Hooks that are run after `git commit` is executed, before the commit message # editor is displayed. These hooks are ideal for syntax checkers, linters, and # other checks that you want to run before you allow a commit object to be # created. PreCommit: ALL: problem_on_unmodified_line: report requires_files: true required: false quiet: false exclude: - "node_modules/**/*" - "spec/fixtures/**/*" - "features/support/cassettes/**/*" - "vendor/assets/**/*" - "public/**/*" - "**/*.tags" - "**/*.tags_sorted_by_file" AuthorEmail: enabled: true description: "Check author email" requires_files: false quiet: true pattern: "^[^@]+@.*$" AuthorName: enabled: true description: "Check for author name" requires_files: false quiet: true Brakeman: enabled: false description: "Check for security vulnerabilities" required_executable: "brakeman" flags: ["--exit-on-warn", "--quiet", "--summary", "--only-files"] install_command: "gem install brakeman" include: - "**/*.rb" BreakpointCheck: enabled: true description: "Check for debugging breakpoint" include: ["**/*.rb", "**/*.coffee"] exclude: [".git_hooks/**/*"] BrokenSymlinks: enabled: true description: "Check for broken symlinks" quiet: true BundleCheck: enabled: true description: "Check Gemfile dependencies" required_executable: "bundle" flags: ["check"] install_command: "gem install bundler" include: - "Gemfile" - "Gemfile.lock" - "*.gemspec" CaseConflicts: enabled: true description: "Check for case-insensitivity conflicts" quiet: true CheckPartialConfigurations: enabled: true description: "Check partial configuration files for deleting used fields" include: 'config/partials/**' HardTabs: enabled: true description: "Check for hard tabs" quiet: true required_executable: "grep" flags: ["-IHn", "\t"] exclude: - "**/*.svg" - "**/vendor/assets/**/*.js" - "**/*.tags" - "**/*.tags_sorted_by_file" - ".gemtags" JsonSyntax: enabled: true description: "Validate JSON syntax" required_library: "json" install_command: "gem install json" include: "**/*.json" LocalPathsInGemfile: enabled: true description: "Check for local paths in Gemfile" required_executable: "grep" flags: ["-IHnE", "^[^#]*((\\bpath:)|(:path[ \t]*=>))"] include: "**/Gemfile" MergeConflicts: enabled: true description: "Check for merge conflicts" quiet: true required_executable: "grep" flags: ["-IHn", "^<<<<<<<[ \t]"] RailsSchemaUpToDate: enabled: true description: "Check if database schema is up to date" include: - "db/migrate/*.rb" - "db/schema.rb" RuboCop: enabled: true description: "Analyze with RuboCop" required_executable: "rubocop" flags: ["--format=emacs", "--force-exclusion", "--display-cop-names", "--config=.rubocop.yml"] install_command: "gem install rubocop" include: - "**/*.gemspec" - "**/*.rake" - "**/*.rb" - "**/Rakefile" exclude: - ".overcommit_gems.rb" - "db/migrate/**/*" FocusCheck: enabled: true description: "Check for focused tests" include: - "spec/**/*_spec.rb" ScssLint: enabled: true description: "Analyze with scss-lint" required_library: "json" required_executable: "scss-lint" flags: ["--format", "JSON"] install_command: "gem install scss-lint" include: "**/*.scss" TrailingWhitespace: enabled: true description: "Check for trailing whitespace" required_executable: "grep" flags: ["-IHn", "[ \t]$"] exclude: - "**/*.svg" - "**/*.jade" - "**/*.js" # all js files should be vendor files - "features/support/cassettes/**/*" YamlSyntax: enabled: true description: "Check YAML syntax" required_library: "yaml" include: - "**/*.yaml" - "**/*.yml" # Hooks that run after HEAD changes or a file is explicitly checked out. PostCheckout: ALL: required: false quiet: false BundleInstall: enabled: false description: "Install Bundler dependencies" requires_files: true required_executable: "bundle" install_command: "gem install bundler" flags: ["install"] include: - "Gemfile" - "Gemfile.lock" - "*.gemspec" IndexTags: enabled: true description: "Generate tags file from source" quiet: true required_executable: "ctags" # Hooks that run during `git rebase`, before any commits are rebased. # If a hook fails, the rebase is aborted. PreRebase: ALL: requires_files: false required: false quiet: false MergedCommits: enabled: true description: "Check for commits that have already been merged" branches: ["master"]