Skip to content

Commit

Permalink
Auto format code and documentation with JuliaFormatter BlueStyle (#105)
Browse files Browse the repository at this point in the history
* Create .JuliaFormatter.toml

* Run JuliaFormatter

* Update formatting instructions

* Use recommended format check action

* Format docstrings and markdown files

* Format docstrings

* Format markdown files

* Exactly one sentence per line

* Increment version number

No functionality changed, but enough code was touched that we increment to be safe.

* Use exact workflow from VersionVigilante

* Revert "Use exact workflow from VersionVigilante"

This reverts commit 6e802f3.
  • Loading branch information
sethaxen authored Jan 17, 2021
1 parent b4548e3 commit 240d8f7
Show file tree
Hide file tree
Showing 39 changed files with 752 additions and 867 deletions.
3 changes: 3 additions & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
style = "blue"
format_docstrings = true
format_markdown = true
44 changes: 0 additions & 44 deletions .github/workflows/format.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/format_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: format-check

on:
push:
branches:
- 'master'
- 'release-'
tags: '*'
pull_request:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1]
julia-arch: [x86]
os: [ubuntu-latest]
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}
- uses: actions/checkout@v1
- name: Install JuliaFormatter and format
run: |
julia -e 'using Pkg; Pkg.add("JuliaFormatter")'
julia -e 'using JuliaFormatter; format(".", verbose=true)'
- name: Format check
run: |
julia -e '
out = Cmd(`git diff --name-only`) |> read |> String
if out == ""
exit(0)
else
@error "Some files have not been formatted !!!"
write(stdout, out)
exit(1)
end'
51 changes: 20 additions & 31 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,39 @@
# ArviZ Community Code of Conduct

ArviZ adopts the NumFOCUS Code of Conduct directly. In other words, we
expect our community to treat others with kindness and understanding.

ArviZ adopts the NumFOCUS Code of Conduct directly.
In other words, we expect our community to treat others with kindness and understanding.

# THE SHORT VERSION
Be kind to others. Do not insult or put down others.
Behave professionally. Remember that harassment and sexist, racist,
or exclusionary jokes are not appropriate.

All communication should be appropriate for a professional audience
including people of many different backgrounds. Sexual language and
imagery are not appropriate.
Be kind to others.
Do not insult or put down others.
Behave professionally.
Remember that harassment and sexist, racist, or exclusionary jokes are not appropriate.

ArviZ is dedicated to providing a harassment-free community for everyone,
regardless of gender, sexual orientation, gender identity, and
expression, disability, physical appearance, body size, race,
or religion. We do not tolerate harassment of community members
in any form.
All communication should be appropriate for a professional audience including people of many different backgrounds.
Sexual language and imagery are not appropriate.

Thank you for helping make this a welcoming, friendly community for all.
ArviZ is dedicated to providing a harassment-free community for everyone, regardless of gender, sexual orientation, gender identity, and expression, disability, physical appearance, body size, race, or religion.
We do not tolerate harassment of community members in any form.

Thank you for helping make this a welcoming, friendly community for all.

# How to Submit a Report
If you feel that there has been a Code of Conduct violation an anonymous
reporting form is available.
**If you feel your safety is in jeopardy or the situation is an
emergency, we urge you to contact local law enforcement before making
a report. (In the U.S., dial 911.)**

If you feel that there has been a Code of Conduct violation an anonymous reporting form is available.
**If you feel your safety is in jeopardy or the situation is an emergency, we urge you to contact local law enforcement before making a report.
(In the U.S., dial 911.)**

We are committed to promptly addressing any reported issues.
If you have experienced or witnessed behavior that violates this
Code of Conduct, please complete the form below to
make a report.
If you have experienced or witnessed behavior that violates this Code of Conduct, please complete the form below to make a report.

**REPORTING FORM:** https://numfocus.typeform.com/to/ynjGdT

Reports are sent to the NumFOCUS Code of Conduct Enforcement Team
(see below).
Reports are sent to the NumFOCUS Code of Conduct Enforcement Team (see below).

You can view the Privacy Policy and Terms of Service for TypeForm here.
The NumFOCUS Privacy Policy is here:
https://www.numfocus.org/privacy-policy

The NumFOCUS Privacy Policy is here: https://www.numfocus.org/privacy-policy

# Full Code of Conduct
The full text of the NumFOCUS/ArviZ.jl Code of Conduct can be found on
NumFOCUS's website
https://numfocus.org/code-of-conduct

The full text of the NumFOCUS/ArviZ.jl Code of Conduct can be found on NumFOCUS's website: https://numfocus.org/code-of-conduct
184 changes: 86 additions & 98 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,139 +1,127 @@
# Guidelines for Contributing

As a scientific community-driven software project, ArviZ.jl welcomes contributions from interested individuals or groups. These guidelines are provided to give potential contributors information to make their contribution compliant with the conventions of the ArviZ.jl project, and maximize the probability of such contributions to be merged as quickly and efficiently as possible.
As a scientific community-driven software project, ArviZ.jl welcomes contributions from interested individuals or groups.
These guidelines are provided to give potential contributors information to make their contribution compliant with the conventions of the ArviZ.jl project and maximize the probability of such contributions to be merged as quickly and efficiently as possible.

There are 4 main ways of contributing to the ArviZ.jl project (in descending order of difficulty or scope):

* Adding new or improved functionality to the existing codebase
* Fixing outstanding issues (bugs) with the existing codebase. They range from low-level software bugs to higher-level design problems.
* Contributing or improving the documentation (`docs`) or examples
* Submitting issues related to bugs or desired enhancements
- Adding new or improved functionality to the existing codebase
- Fixing outstanding issues (bugs) with the existing codebase. They range from low-level software bugs to higher-level design problems.
- Contributing or improving the documentation (`docs`) or examples
- Submitting issues related to bugs or desired enhancements

# Opening issues

We appreciate being notified of problems with the existing ArviZ.jl code. We prefer that issues be filed the on [Github Issue Tracker](https://github.com/arviz-devs/ArviZ.jl/issues), rather than on social media or by direct email to the developers.
We appreciate being notified of problems with the existing ArviZ.jl code.
We prefer that issues be filed the on [Github Issue Tracker](https://github.com/arviz-devs/ArviZ.jl/issues), rather than on social media or by direct email to the developers.

Please verify that your issue is not being currently addressed by other issues or pull requests by using the GitHub search tool to look for key words in the project issue tracker.

# Contributing code via pull requests

While issue reporting is valuable, we strongly encourage users who are
inclined to do so to submit patches for new or existing issues via pull
requests. This is particularly the case for simple fixes, such as typos
or tweaks to documentation, which do not require a heavy investment
While issue reporting is valuable, we strongly encourage users who are inclined to do so to submit patches for new or existing issues via pull requests.
This is particularly the case for simple fixes, such as typos or tweaks to documentation, which do not require a heavy investment
of time and attention.

Contributors are also encouraged to contribute new code to enhance ArviZ.jl's
functionality, also via pull requests.
Please consult the [ArviZ.jl documentation](https://arviz-devs.github.io/ArviZ.jl/)
to ensure that any new contribution does not strongly overlap with existing functionality.
Contributors are also encouraged to contribute new code to enhance ArviZ.jl's functionality, also via pull requests.
Please consult the [ArviZ.jl documentation](https://arviz-devs.github.io/ArviZ.jl/) to ensure that any new contribution does not strongly overlap with existing functionality.

In general, new analysis tools such as plots, statistics, and diagnostics
should be contributed directly to [ArviZ](https://arviz-devs.github.io/arviz/).
Julia-specific tools such as improvements to the API, documentation, custom
types, conversion functions, and interfaces with other Julia packages should
be added to ArviZ.jl.
In general, new analysis tools such as plots, statistics, and diagnostics should be contributed directly to [ArviZ](https://arviz-devs.github.io/arviz/).
Julia-specific tools such as improvements to the API, documentation, custom types, conversion functions, and interfaces with other Julia packages should be added to ArviZ.jl.

The preferred workflow for contributing to ArviZ.jl is to fork
the [GitHub repository](https://github.com/arviz-devs/ArviZ.jl/), clone it to your local machine, and develop on a feature branch.

For more instructions see the
[Pull request checklist](#pull-request-checklist)
For more instructions see the [Pull request checklist](#pull-request-checklist).

### Consistency with ArviZ
To facilitate each transfer between platforms, ArviZ.jl should as much as
possible keep the same interface, behavior, and style for official API
functions as [ArviZ](https://arviz-devs.github.io).

To facilitate each transfer between platforms, ArviZ.jl should as much as possible keep the same interface, behavior, and style for official API functions as [ArviZ](https://arviz-devs.github.io).

### Code Formatting
For code generally follow the
[Julia style guide](https://docs.julialang.org/en/v1/manual/style-guide/index.html)
and the [Blue Style Guide](https://github.com/invenia/BlueStyle), the latter
taking precedence.

For code generally follow the [Julia style guide](https://docs.julialang.org/en/v1/manual/style-guide/index.html) and the [BlueStyle Guide](https://github.com/invenia/BlueStyle), the latter taking precedence.

Before submission, final formatting should be done with
[JuliaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl).
For more detailed steps on a typical development workflow see the
[Pull request checklist](#pull-request-checklist)

### Docstring formatting
Functions intended for use by a user must be documented and should follow the
[Blue documentation guide](https://github.com/invenia/BlueStyle#documentation)
Please reasonably document any additions or changes to the codebase,
when in doubt, add a docstring.

## Steps

1. Fork the [project repository](https://github.com/arviz-devs/ArviZ.jl/) by clicking on the 'Fork' button near the top right of the main repository page. This creates a copy of the code under your GitHub user account.

2. Clone your fork of the ArviZ.jl repo from your GitHub account to your local disk and add the base repository as a remote:

```bash
$ git clone [email protected]:<your GitHub handle>/ArviZ.jl.git
$ cd ArviZ.jl
$ git remote add upstream [email protected]:arviz-devs/ArviZ.jl.git
```

3. Create a ``feature`` branch to hold your development changes:

```bash
$ git checkout -b my-feature
```

Always use a ``feature`` branch. It's good practice to never routinely work on the ``master`` branch of any repository.

4. Package dependencies are in ``Project.toml``. To set up a development
environment, in the Julia REPL run:

```julia
] dev .
```

5. Develop the feature on your feature branch. Add changed files using ``git add`` and then ``git commit`` files:
Functions intended for use by a user must be documented and should follow the [BlueStyle documentation guide](https://github.com/invenia/BlueStyle#documentation).
Please reasonably document any additions or changes to the codebase, when in doubt, add a docstring.

```bash
$ git add modified_files
$ git commit
```

to record your changes locally.
After committing, it is a good idea to sync with the base repository in case there have been any changes:
```bash
$ git fetch upstream
$ git rebase upstream/master
```

Then push the changes to your GitHub account with:

```bash
$ git push -u origin my-feature
```
## Steps

6. Go to the GitHub web page of your fork of the ArviZ.jl repo. Click the 'Pull request' button to send your changes to the project's maintainers for review. This will send an email to the committers.
1. Fork the [project repository](https://github.com/arviz-devs/ArviZ.jl/) by clicking on the 'Fork' button near the top right of the main repository page. This creates a copy of the code under your GitHub user account.

2. Clone your fork of the ArviZ.jl repo from your GitHub account to your local disk and add the base repository as a remote:

```bash
$ git clone [email protected]:<your GitHub handle>/ArviZ.jl.git
$ cd ArviZ.jl
$ git remote add upstream [email protected]:arviz-devs/ArviZ.jl.git
```
3. Create a ``feature`` branch to hold your development changes:

```bash
$ git checkout -b my-feature
```

Always use a ``feature`` branch.
It's good practice to never routinely work on the ``master`` branch of any repository.
4. Package dependencies are in ``Project.toml``.
To set up a development environment, from the Julia REPL, type `]` to enter the Pkg REPL mode and run
```
pkg> dev .
```
5. Develop the feature on your feature branch.
Add changed files using ``git add`` and then ``git commit`` files:
```bash
$ git add modified_files
$ git commit
```
to record your changes locally.
After committing, it is a good idea to sync with the base repository in case there have been any changes:
```bash
$ git fetch upstream
$ git rebase upstream/master
```
Then push the changes to your GitHub account with:
```bash
$ git push -u origin my-feature
```
6. Go to the GitHub web page of your fork of the ArviZ.jl repo.
Click the 'Pull request' button to send your changes to the project's maintainers for review.
This will send an email to the committers.

## Pull request checklist

We recommend that your contribution complies with the following guidelines before you submit a pull request:

* If your pull request addresses an issue, please use the pull request title to describe the issue and mention the issue number in the pull request description. This will make sure a link back to the original issue is created.

* All public methods must have informative docstrings with sample usage when appropriate.

* Please prefix the title of incomplete contributions with `[WIP]` (to indicate a work in progress). WIPs may be useful to (1) indicate you are working on something to avoid duplicated work, (2) request broad review of functionality or API, or (3) seek collaborators.

* All other tests pass when everything is rebuilt from scratch.

* Documentation and high-coverage tests are necessary for enhancements to be accepted.

* Documentation follows Blue style guide

* Code coverage **cannot** decrease. Coverage is automatically checked on all pull requests

* Your code has been formatted with [JuliaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl) with default settings. From the REPL:

```julia
julia> using JuliaFormatter
julia> format("src/")
```
- If your pull request addresses an issue, please use the pull request title to describe the issue and mention the issue number in the pull request description.
This will make sure a link back to the original issue is created.
- All public methods must have informative docstrings with sample usage when appropriate.
- Please prefix the title of incomplete contributions with `[WIP]` (to indicate a work in progress).
WIPs may be useful to (1) indicate you are working on something to avoid duplicated work, (2) request broad review of functionality or API, or (3) seek collaborators.
- All other tests pass when everything is rebuilt from scratch.
- Documentation and high-coverage tests are necessary for enhancements to be accepted.
- Documentation follows BlueStyle guide
- Code coverage **cannot** decrease.
Coverage is automatically checked on all pull requests
- Your code and documentation has been formatted with [JuliaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl) with BlueStyle.
_From the ArviZ.jl repo_, execute

```bash
$ julia -e 'using Pkg; Pkg.add("JuliaFormatter");
using JuliaFormatter; format(".")'
```

#### This guide was derived from the [ArviZ guidelines for contributing](https://github.com/arviz-devs/arviz/blob/master/CONTRIBUTING.md)
Loading

2 comments on commit 240d8f7

@sethaxen
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/28104

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.11 -m "<description of version>" 240d8f72a8f1f798d96351bbbfd1abb2ae654a6b
git push origin v0.4.11

Please sign in to comment.