Closed Remi-Gau closed 3 years ago
@Remi-Gau: please do open a PR for the travis stuff, since I am very unfamiliar with it. That said, since the stuff you linked is pretty simple I can make a stab at my own version. But some comments on the linked config:
stable
branch :)doc
and describe it in https://florianschanda.github.io/miss_hit/configuration.html since that document will/should contain everything about configuring and setting up miss_hit for your projectAlso, in your opinion, what would you put in the pre-commit hook, and what would you put in the pre-push hook?
I can see two scenarios:
Pre-commit:
Post-commit:
Pre-commit:
Post-commit
@Remi-Gau: please do open a PR for the travis stuff, since I am very unfamiliar with it. That said, since the stuff you linked is pretty simple I can make a stab at my own version. But some comments on the linked config:
* Ideally clone the latest release, not master (I do try to keep things non-broken, but it's not guaranteed) * I suppose for that I need to have a `stable` branch :) * I was thinking of putting this into `doc` and describe it in https://florianschanda.github.io/miss_hit/configuration.html since that document will/should contain everything about configuring and setting up miss_hit for your project
Yup I am about to start some sort of template repo for matlab analysis, I would use that to test those config files for travis and github actions.
The thing is that I have some experiments to prepare for next week, so don't expect a first PR before the end of next week. :running_man:
Good point on using on a release for those CI things.
Good idea about having this in the doc. :smile: :rocket:
Also, in your opinion, what would you put in the pre-commit hook, and what would you put in the pre-push hook?
I can see two scenarios:
1
Pre-commit:
* mh_style --fix
Post-commit:
* mh_style * mh_metric --ci
2
Pre-commit:
* mh_style --fix * mh_metric --ci
Post-commit
* Nothing
Slight preference for scenario one, as it allows you to commit some code that you then get some metric info about so you can eventually refactor and to improve things.
I like to try to keep first draft and refactoring separated. But maybe that's just me.
What do you think ?
Started a quick and dirty repo to design a matlab analysis template. https://github.com/Remi-Gau/template_matlab_analysis/issues/1
Will create a the templates for the linter there and then make a PR on this repo. Is that good with you @florianschanda ?
Sounds good, yeah! I will try and write some more documentation soon!
hey @florianschanda
This could be a template for a .travis.yml
. Very light weight but gets the job done
# Travis CI (https://travis-ci.org/)
# This will only work on your repo if you have an account on travis and you
# have set it up to run continuous integration on this this repo
# Linux distribution (bionic beaver)
dist: bionic
# Language and version
language: python
python:
- "3.6" # current default Python on Travis CI
cache:
apt: true # only works with Pro version
# Install the miss_hit linter
before_install:
- pip3 install miss_hit
# Lists all the tasks we will do
jobs:
include:
- name: "miss_hit: checking code quality"
script: mh_metric . --ci
- name: "miss_hit: checking code style"
script: mh_style .
And this would be the template for a github action
name: miss_hit
on:
push:
branches:
- master
pull_request:
branches: '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 1
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
pip3 install install miss_hit
- name: Miss_hit code quality
run: |
mh_metric . --ci
- name: Miss_hit code style
run: |
mh_style .
Let me know if you want me to open in the a PR to put that in the doc. :-)
Nah, I'll add it directly.
Now that I see it, using installation from pypi is the obvious way to get to the latest stable release :)
Hi @florianschanda, first of all, awesome project! We've been looking for some automated MATLAB style checking (and fixing) for some time now. This project works like charm, your effort is much appreciated 👍
I wrote a hook for the pre-commit framework based on miss_hit. Would you be open for a PR to include it here?
If so, the only obstacle would be that pre-commit Python hooks require a repo to be installable via pip install .
i.e. it requires a setup.py
in the root. Not sure if this is a change you're willing to make though ... let me know what you think.
Hi @wbekerom thank you for the kind words!
Yes, by all means open a PR; we can always discuss the details in it.
As to having setup.py in the root of MISS_HIT; this is not so easy. Have a look in the makefile under "package", you can see there is careful swapping in-and-out of setup_gpl.py and setup_agpl.py.
Yeah, I already noticed the swapping the the makefile. Will have a go at it, a PR is coming your way.
Closing, since the pre-commit stuff seems to work pretty well. A naked hook might also be good to have, will add if there is demand.
A couple of template files users could add to their repo or their .git/hook folder to make sure that their code is up to their standards before committing / pushing / merging.
For continuous integration:
For git hooks