Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add spell check #313

Merged
merged 3 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
- name: Install dependencies
run: make install

- name: Spell check
run: make spellcheck

- name: Check syntax
run: make test-build

Expand Down
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,21 @@ install:

test:
@${MAKE} lint
@${MAKE} spellcheck
@${MAKE} test-build

test-build:
@${MAKE} dummy SPHINXOPTS="--quiet --fail-on-warning"

lint: # requires Node and NPM to be installed
@npx --yes markdownlint-cli "**/*.md"

spellcheck: # check for spelling errors
@codespell

test-build:
@${MAKE} dummy SPHINXOPTS="--quiet --fail-on-warning"

format: # requires Node and NPM to be installed
@npx --yes markdownlint-cli --fix "**/*.md"
@codespell --write-changes

# Serve the documentation in dev mode.
dev:
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[tool.codespell]
ignore-words-list = [ "Calculs", "moteur", "ressource", "ALS" ]
skip = "*.js,./build,./src/openfisca-core"
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
--editable git+https://github.com/openfisca/openfisca-core.git@master#egg=OpenFisca-Core[dev]
codespell==2.3.0
guzzle_sphinx_theme==0.7.11
myst-parser==3.0.1
sphinx-autobuild==2024.4.16
Expand Down
4 changes: 2 additions & 2 deletions source/coding-the-legislation/20_input_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class housing_tax(Variable):
def formula(household, period, legislation):
accommodation_size = household('accomodation_size', period)
housing_occupancy_status = household('housing_occupancy_status', period)
HousingOccupancyStatus = housing_occupancy_status.possible_values # "Import" the enum type. Careful: do not use python imports accross variables files: comparisons would not work!
HousingOccupancyStatus = housing_occupancy_status.possible_values # "Import" the enum type. Careful: do not use python imports across variables files: comparisons would not work!
tenant = (housing_occupancy_status == HousingOccupancyStatus.tenant)
owner = (housing_occupancy_status == HousingOccupancyStatus.owner)

Expand All @@ -124,7 +124,7 @@ class housing_tax(Variable):
You can now test the formula in a YAML test:

```yaml
- name: Household with free lodger status living in a 100 sq.meters accomodation
- name: Household with free lodger status living in a 100 sq.meters accommodation
period: 2017
input:
accomodation_size:
Expand Down
2 changes: 1 addition & 1 deletion source/coding-the-legislation/40_legislation_evolutions.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ After this change, in a formula:

## Formula evolution

Some fiscal or benefit mechanism significantly evolve over time and call for a change in the formula that computes them. In this case, a simple parameter adjustement is not enough.
Some fiscal or benefit mechanism significantly evolve over time and call for a change in the formula that computes them. In this case, a simple parameter adjustment is not enough.

For instance, let's assume that from the 1st of Jan. 2017, the `flat_tax_on_salary` is not applied anymore on the first `1000` earned by a person.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Bootstraping a new country package
# Bootstrapping a new country package

If you want to use OpenFisca to run simulations about your own country's legislation, our [country package template](https://github.com/openfisca/country-template/) will provide you all the instructions and boilerplate code you need to quickly get something working.

Expand Down
12 changes: 6 additions & 6 deletions source/coding-the-legislation/legislation_parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Sometimes, the value of a parameter depends on a variable (e.g. a housing benefi

To be more specific, let's assume that:

* Households who rent their accomodation can get a `housing_benefit`
* Households who rent their accommodation can get a `housing_benefit`
* The amount of this benefit depends on which `zone` the household lives in. The `zone` can take only three values: `zone_1`, `zone_2` or `zone_3`.
* The amount also depends on the composition of the household.

Expand Down Expand Up @@ -223,7 +223,7 @@ zone_3:
value: 50
```

Then the formula calculting `housing_benefit` can be implemented with:
Then the formula calculating `housing_benefit` can be implemented with:

```py
def formula(household, period, parameters):
Expand All @@ -240,15 +240,15 @@ def formula(household, period, parameters):

If there are many households in your simulation, this parameter will be **vectorial**: it may have a different value for each household of your entity.

To be able to use this notation, all the children node of the parameter node `housing_benefit` must be **homogenous**. In the previous example, `housing_benefit.zone_1`, `housing_benefit.zone_2`, `housing_benefit.zone_3` are homogenous, as they have the same subnodes.
To be able to use this notation, all the children node of the parameter node `housing_benefit` must be **homogeneous**. In the previous example, `housing_benefit.zone_1`, `housing_benefit.zone_2`, `housing_benefit.zone_3` are homogeneous, as they have the same subnodes.

However, let's imagine that `housing_benefit.yaml` had another subnode named `coeff_furnished`, which described a coefficient to apply to the benefit is the accomodation is rented furnished:
However, let's imagine that `housing_benefit.yaml` had another subnode named `coeff_furnished`, which described a coefficient to apply to the benefit is the accommodation is rented furnished:

`housing_benefit.yaml` content:

```yaml
coeff_furnished:
description: "Coefficient to apply if the accomodation is rented furnished"
description: "Coefficient to apply if the accommodation is rented furnished"
values:
2015-01-01:
value: 0.75
Expand All @@ -269,7 +269,7 @@ To solve this issue, the good practice would be to create an intermediate node `

```yaml
coeff_furnished:
description: "Coefficient to apply if the accomodation is rented furnished"
description: "Coefficient to apply if the accommodation is rented furnished"
values:
2015-01-01:
value: 0.75
Expand Down
4 changes: 2 additions & 2 deletions source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@

github_doc_root = 'https://github.com/openfisca/openfisca-doc/tree/main/'

# 'config-cache' supresses: Warning cannot cache unpickable configuration value: 'recommonmark_config' (because it contains a function, class, or module object)
# 'config-cache' suppresses: Warning cannot cache unpickable configuration value: 'recommonmark_config' (because it contains a function, class, or module object)
suppress_warnings = ['image.nonlocal_uri','config.cache']

# Supresses warning "more than one target found for cross-reference" affecting:
# Suppresses warning "more than one target found for cross-reference" affecting:
# - openfisca_core.periods.Instant
# - openfisca_core.simulations.simulation_builder.SimulationBuilder -> TaxBenefitSystem
autodoc_default_options = {
Expand Down
2 changes: 1 addition & 1 deletion source/installation/access-countrys-source-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The `OpenFisca-Country-Template` installation instructions are in its `README` [

Generally when making changes to legislation, there is a need to test the changes with a situation that works with the country's tax and benefit system.

Sometimes, these situations can be quite complicated to model. Instead of rewriting them everytime, they can be packaged in different formats:
Sometimes, these situations can be quite complicated to model. Instead of rewriting them every time, they can be packaged in different formats:

* As [YAML tests](./../coding-the-legislation/writing_yaml_tests.md) when the expected output result should be registered.
* As [JSON requests](./../openfisca-web-api/input-output-data.md#describing-the-situation) when the output isn't being tested. Refer to [these examples](https://github.com/openfisca/country-template/tree/main/openfisca_country_template/situation_examples) in the `OpenFisca-Country-Template` repository. These can be adapted as requests to be sent to the OpenFisca web API.
Expand Down
2 changes: 1 addition & 1 deletion source/openfisca-python-api/openfisca_serve.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ You can setup ``openfisca serve`` using a configuration file. Be careful as para

Using gunicorn directly
^^^^^^^^^^^^^^^^^^^^^^^
If for any reason you nedd to run ``gunicorn`` directly, you can. See this example of ``gunicorn`` application:
If for any reason you need to run ``gunicorn`` directly, you can. See this example of ``gunicorn`` application:

**app.py:**

Expand Down