Commit Graph

3 Commits

Author SHA1 Message Date
Cody Cutrer 7b0031a2fe rubocop: install pre-commit hook in plugins
Change-Id: Ica5fdc2ea8306483e8597b9c4ea4f40f92b13c24
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279017
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-19 22:59:56 +00:00
Bryan Petty 3940d4690a minor linux docker development tweaks
This adds an additional check in the git install_hooks script to see if
the hook is already set as executable before attempting to chmod it. So
if it's already setup manually, or outside of Docker first, and file
write permission hasn't been granted to Docker, it doesn't fail even
though it's already done.

This also adds a new environment variable:
- CANVAS_SKIP_DOCKER_USERMOD: If defined, the Docker image build
  disables the inefficient usermod functionality, even if you're running
  Linux, the same way it does everywhere else. You would want to use
  this if you have solved Docker bind-mounted filesystem permissions
  another way.

flag=none

Test Plan:
- On Linux, export CANVAS_SKIP_DOCKER_USERMOD=1;
- ./script/docker_dev_setup.sh
- Verify app containers still run with "docker" user as UID 9999.
- Verify no changes on OSX.

Change-Id: I5bdb4ce21e9a41dec2bb99d4284ac73a067f5899
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/256275
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Bryan Petty <bpetty@instructure.com>
Product-Review: Bryan Petty <bpetty@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
2021-01-13 18:48:08 +00:00
Clay Diffrient 93a6d18046 Add precommit hook for auto fixing files
This only affects javascript files and only affects things
from the prettier whitelist

This will run slowly if you don't have node_modules installed
locally (e.g., in Docker), but it will gladly attempt to
run things in Docker for you.

This adds a new githook_installer image that will install
the githook whenever a docker-compose up happens in the
repo.  It will also install the hook whenever a `yarn`
occurs locally (as a postinstall hook).

This commit should also not fail things.  For example
having unused variables is an ESLint error, but it isn't
autofixable.  It will log the error, but will otherwise
continue.  However, it will make this pretty with prettier
as well as fix any other autofixable ESLint errors.

closes CORE-2118

Test Plan:
  - Run `yarn`
  - Add some semicolons to something from the whitelist
  - git add that file
  - git commit and it will strip semicolons
  - In a dockerized Canvas:
     - docker-compose up
     - Add semicolons to a file
     - git add that file
     - git commit, it will take forever (~60s)
     - It should have stripped out semicolons

Change-Id: Id9198aa008808e898f29acb9ed64dd14ff843222
Reviewed-on: https://gerrit.instructure.com/171510
Tested-by: Jenkins
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
QA-Review: Brent Burgoyne <bburgoyne@instructure.com>
Product-Review: Brent Burgoyne <bburgoyne@instructure.com>
2018-11-27 21:07:31 +00:00