Skip to content

Commit

Permalink
Merge pull request #212 from ocefpaf/pre-commits
Browse files Browse the repository at this point in the history
add pre-commits
  • Loading branch information
ocefpaf authored Aug 21, 2023
2 parents 0c45acf + fbe7454 commit 1495287
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 9 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# See https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
labels:
- "Bot"
34 changes: 34 additions & 0 deletions .github/workflows/md-link-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Check Markdown links

on:
pull_request:
push:
branches:
- main

jobs:
markdown-link-check:
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Check gh-pages
if: github.ref == 'refs/heads/gh-pages'
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'
config-file: 'mlc_config.json'
file-path: './README.md'
folder-path: '_docs/'

- name: Check main
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'
file-path: './README.md'
8 changes: 8 additions & 0 deletions .github/workflows/mlc_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ignorePatterns": [
{
"pattern": "://localhost"
}
],
"aliveStatusCodes": [200, 0]
}
30 changes: 30 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
# - id: trailing-whitespace
# - id: end-of-file-fixer
- id: check-added-large-files

- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
hooks:
- id: codespell
exclude: >
(?x)^(
.*\.yaml
)$
args:
- --ignore-words-list=nd,ot


ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
autofix_prs: false
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: monthly
skip: []
submodules: false
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Glider DAC
==========
[![Build Status](https://travis-ci.com/ioos/glider-dac.svg?branch=master)](https://travis-ci.com/ioos/glider-dac)
[![Build Status](https://travis-ci.org/ioos/glider-dac.svg?branch=master)](https://travis-ci.org/ioos/glider-dac)
[![Check Markdown links](https://github.com/ioos/glider-dac/actions/workflows/md-link-check.yml/badge.svg)](https://github.com/ioos/glider-dac/actions/workflows/md-link-check.yml)

This is the main repository for the IOOS Glider DAC site, scripts, and tools

Expand Down
2 changes: 1 addition & 1 deletion glider_dac/models/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def on_complete(self):

def get_latest_nc_file(self):
'''
Returns the lastest netCDF file found in the directory
Returns the latest netCDF file found in the directory
:param str root: Root of the directory to scan
'''
Expand Down
4 changes: 2 additions & 2 deletions glider_dac_watchdog.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ def file_moved_or_created(self, event):
navo_deployment_directory = None
possible_existing_dirs = list(glob.iglob(os.path.join(navo_directory, f"{glider_callsign}*")))
# Use an already existing directory if there is one for the the deployment
# TODO: handle for mulitple possible existing callsigns if new deployment is made?
# TODO: handle for multiple possible existing callsigns if new deployment is made?
for maybe_dir in possible_existing_dirs:
if os.path.isdir(maybe_dir):
navo_deployment_directory = maybe_dir
# TODO: handle for mulitple possible existing callsigns if new deployment is made?
# TODO: handle for multiple possible existing callsigns if new deployment is made?
break
# otherwise specify a dir to be created
if not navo_deployment_directory:
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_erddap_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ def check_for_qc_vars(nc):

def get_latest_nc_file(root):
'''
Returns the lastest netCDF file found in the directory
Returns the latest netCDF file found in the directory
:param str root: Root of the directory to scan
'''
Expand Down
2 changes: 1 addition & 1 deletion scripts/download_waf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
scripts/download_waf.py
A script to scrape ISO 19115 Documents from a running ERDDAP instance. In the
case of Glider DAC, this should download from the public ERDDAP isntance. The
case of Glider DAC, this should download from the public ERDDAP instance. The
documents should be in a directory with no other contents and served as a
static directory.
'''
Expand Down
4 changes: 2 additions & 2 deletions scripts/replicatePrivateErddapDeployments.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ async def retrieve_data(where, deployment, sem, proto='http'):
except Exception as e:
fail_counter -= 1
log.exception("Failed to get %s", deployment)
log.info("Attempts remainging: %s", fail_counter)
log.info("Attempts remaining: %s", fail_counter)
if fail_counter <= 0:
break

Expand Down Expand Up @@ -221,7 +221,7 @@ def acquire_lock(path):
str_pid = f.read()
pid = int(str_pid)
if check_pid(pid):
raise IOError("Lock is already aquired")
raise IOError("Lock is already acquired")

with open(path, 'w') as f:
f.write("{}\n".format(os.getpid()))
Expand Down
2 changes: 1 addition & 1 deletion scripts/sync_erddap_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def acquire_lock(path):
str_pid = f.read()
pid = int(str_pid)
if check_pid(pid):
raise IOError("Lock is already aquired")
raise IOError("Lock is already acquired")

with open(path, 'w') as f:
f.write("{}\n".format(os.getpid()))
Expand Down

0 comments on commit 1495287

Please sign in to comment.