Skip to content

Commit

Permalink
Merge pull request #249 from os-climate/implement-eslint-for-toml
Browse files Browse the repository at this point in the history
Implement eslint for toml
  • Loading branch information
ModeSevenIndustrialSolutions authored Sep 20, 2023
2 parents 48c9f68 + f918ece commit e39ddbf
Show file tree
Hide file tree
Showing 24 changed files with 106 additions and 39 deletions.
40 changes: 40 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": [
// add generic rulesets here, such as:
'eslint:recommended',
'plugin:toml/standard'
],
"overrides": [
{
"env": {
"node": true
},
"files": [
".eslintrc.{js,cjs}"
],
"parserOptions": {
"sourceType": "script"
}
}
],
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": "latest"
},
"overrides": [
{
files: ["*.toml"],
parser: "toml-eslint-parser",
},
],
"rules": {
"comma-spacing": "error",
"no-multi-spaces": ["error", { "exceptions": { "TOMLKeyValue": true } }],
"no-multiple-empty-lines": "error",
"no-trailing-spaces": "error"
}
}
16 changes: 11 additions & 5 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
---
name: "🧪 Linting checks"

on: push # yamllint disable-line rule:truthy
# yamllint disable-line rule:truthy
on:
pull_request:
types:
[opened, reopened, edited]

jobs:
lint:
Expand All @@ -12,11 +16,13 @@ jobs:
- name: "Checkout repository"
uses: actions/checkout@v3

- name: "Installing: yamllint"
run: pip install yamllint

- name: "Checking YAML files (yamllint)"
run: yamllint .
run: |
pip install yamllint
yamllint .
- name: "Checking TOML files (gh-action-toml-linter)"
uses: yisonPylkita/gh-action-toml-linter@0.1.3

- name: "Checking GitHub Actions (actionlint)"
id: actionlint
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ __pycache__/
.pdm-python
build/
develop-eggs/
dist/.*
dist/**
!app/static/frontend/dist/
downloads/
eggs/
Expand Down
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,16 @@ repos:
# pre-commit's default_language_version, see
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.11

- repo: https://github.com/pre-commit/mirrors-eslint
rev: 'v8.49.0'
hooks:
- id: eslint
files: \^*.toml
types: [file]
additional_dependencies:
- eslint
- eslint-config-google
- eslint-loader
- eslint-plugin-react
- babel-eslint
67 changes: 35 additions & 32 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,31 @@
name = "ITR"
version = "1.0.5"
description = "Assess the temperature alignment of current targets, commitments, and investment and lending portfolios."
authors = [
{name = "Ortec Finance",email = "joris.cramwinckel@ortec-finance.com"},
]
# dynamic = ["dependencies"]
authors = [ { name = "Ortec Finance", email = "joris.cramwinckel@ortec-finance.com" }, ]
requires-python = ">=3.9"
readme = "README.md"
license = {text = "Apache-2.0"}
keywords = ["Climate", "ITR", "Finance"]
license = { text = "Apache-2.0" }
keywords = [
"Climate",
"ITR",
"Finance"
]
classifiers = [
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: Unix",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.9",
"Topic :: Office/Business :: Financial",
"Topic :: Scientific/Engineering",
"Topic :: Software Development",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: Unix",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.9",
"Topic :: Office/Business :: Financial",
"Topic :: Scientific/Engineering",
"Topic :: Software Development",
]

[project.urls]
Expand All @@ -34,22 +35,24 @@ Downloads = "https://github.com/os-climate/ITR/releases"
"Bug Tracker" = "https://github.com/os-climate/ITR/issues"
Documentation = "https://github.com/os-climate/ITR/tree/main/docs"
"Source Code" = "https://github.com/os-climate/ITR"

[project.optional-dependencies]
dev = [
"nose2",
]
dev = [ "nose2" ]

[build-system]
requires = ["setuptools>=65.7.0", "setuptools-scm"]
build-backend = "setuptools.build_meta"
# requires = ["pdm-backend"]
# build-backend = "pdm.backend"
requires = [
# "setuptools>=65.7.0",
# "setuptools-scm",
"pdm-backend"
]
# build-backend = "setuptools.build_meta"
build-backend = "pdm.backend"

[tool.pdm.build]
dependencies = {file = ["requirements-dev.txt"]}
source-includes = ["ITR"]
dependencies = { file = [ "requirements-dev.txt" ] }
# source-includes = [ "ITR" ]
run-setuptools = true

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
optional-dependencies = {dev = { file = ["requirements-dev.txt"] }}
dependencies = { file = [ "requirements.txt" ] }
optional-dependencies = { dev = { file = [ "requirements-dev.txt" ] } }
6 changes: 6 additions & 0 deletions scripts/linting.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

npm install eslint @babel/core @babel/eslint-parser --save-dev
echo "Run with: eslint --ext .toml ."
pre-commit install
pre-commit autoupdate
1 change: 0 additions & 1 deletion src/ITR

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit e39ddbf

Please sign in to comment.