Skip to content

Commit

Permalink
Some improvements to problem matcher, added test fail file.
Browse files Browse the repository at this point in the history
  • Loading branch information
CallumWalley committed Sep 25, 2024
1 parent 3b89aa7 commit 4cc6884
Show file tree
Hide file tree
Showing 8 changed files with 367 additions and 5 deletions.
25 changes: 25 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug Proselint",
"type": "debugpy",
"request": "launch",
"program": "checks/run_proselint.py",
"args": ["docs/index.md"],
"console": "integratedTerminal",
"justMyCode": false
},
{
"name": "Debug Testbuild",
"type": "debugpy",
"request": "launch",
"program": "checks/run_test_build.py",
"console": "integratedTerminal",
"justMyCode": false
}
]
}
3 changes: 2 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"column": 4,
"endLine": 5,
"message": 7,
"loop": true
},
"owner": "proselint",
"fileLocation": "autoDetect",
Expand Down Expand Up @@ -94,7 +95,7 @@
"column": 4,
"endColumn": 5,
"line": 6,
"message": 7
"message": 7,
},
"owner": "test-build",
"fileLocation": [
Expand Down
3 changes: 2 additions & 1 deletion checks/run_meta_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def _run_check(f):
for r in f():
print(f"::{r.get('level', 'warning')} file={input_path},title={f.__name__},col={r.get('col', 0)},endColumn={r.get('endColumn', 99)},line={r.get('line', 1)}::{r.get('message', 'something wrong')}")
sys.stdout.flush()
time.sleep(0.01)



def _title_from_filename():
Expand Down Expand Up @@ -268,4 +270,3 @@ def _count_children(d):

# FIXME terrible hack to make VSCode in codespace capture the error messages
# see https://github.com/microsoft/vscode/issues/92868 as a tentative explanation
time.sleep(5)
4 changes: 3 additions & 1 deletion checks/run_proselint.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import sys
from pathlib import Path
import time

import proselint
from proselint import config, tools
Expand All @@ -22,10 +23,11 @@
for file in files:
print(f"Running proselint on {file}")
content = Path(file).read_text(encoding="utf8")
fails = proselint.tools.lint(content, config=config_custom)
for notice in proselint.tools.lint(content, config=config_custom):
print(
f"::{notice[7]} file={file},line={notice[2]+1},"
f"col={notice[3]+2},endColumn={notice[2]+notice[6]+1},"
f"title={notice[0]}::'{notice[1]}'",
flush=True,
)
time.sleep(0.01)
13 changes: 12 additions & 1 deletion checks/run_test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
import logging
import sys
import re
import time


"""
This doesnt work and I have no idea why.
This works but is a bit messy
"""


def parse_macro(record):

# These are not useful messages
Expand All @@ -29,6 +32,13 @@ def parse_macro(record):
record.name = g["title"]
record.filename = g["file"]
record.msg = g["message"]

# Does not give correct path to file in question in 'title'.
# Infer from message.
m = re.search(r"'(.*?\.md)'", record.msg)
if m:
record.filename = m.group(1)

return True


Expand All @@ -42,3 +52,4 @@ def parse_macro(record):
log.addHandler(sh)
config = load_config(config_file_path="./mkdocs.yml")
build.build(config)
time.sleep(5)
163 changes: 163 additions & 0 deletions docs/fail_checks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
---

Check failure on line 1 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check page meta

misc

'children'
template: main.html
hide: toc
title: Fail Checks
invalid-entry: something
---

# Fail Checks

Designed to trigger as many fails as possible.

## Spelling Checks

speling checkces arre gooder

Check warning on line 14 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Spelling

spelling

Word 'speling' is misspelled.

Check warning on line 14 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Spelling

spelling

Word 'checkces' is misspelled.

Check warning on line 14 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Spelling

spelling

Word 'arre' is misspelled.

Check warning on line 14 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Spelling

spelling

Word 'gooder' is misspelled.

## Link checks

### Missing image

![fake image](../docs/assets/fake_image.png)

### Missing link

[fake link](../docs/fake_page.md)

### Missing Anchor

[missing anchor](#missinganchor) (Correct would be `#missing-anchor`)

typos in cobedlocks or links should be allowed.

Check warning on line 30 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Spelling

spelling

Word 'cobedlocks' is misspelled.

```md
Thats not how you spell cobedlocks at all.

Check warning on line 33 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Spelling

spelling

Word 'cobedlocks' is misspelled.
```

[tpyos should be picked up here](www.butnothere.com)

Check warning on line 36 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Spelling

spelling

Word 'tpyos' is misspelled.

### Naked links

www.nesi.org.nz


## Structure

#### Skipping a level

## Only child


## Prose checks

The 1950's were a swell time.

Check warning on line 52 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Prose

dates_times.dates

'Apostrophes aren't needed for decades.'
The 50's were a swell time.

Check warning on line 53 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Prose

dates_times.dates

'Apostrophes aren't needed for decades.'
Things happened from 1980-1999 and from 240-398 A.D.

Check warning on line 54 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Prose

dates_times.dates

'When specifying a date range, write 'from X to Y'.'

Check warning on line 54 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Prose

dates_times.dates

'When specifying a date range, write 'from X to Y'.'
March, 2013 was notable in that

Check warning on line 55 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Prose

dates_times.dates

'When specifying a month and year, no comma is needed.'
In February of 2010, the mayor considered

Check warning on line 56 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Prose

dates_times.dates

'When specifying a month and year, 'of' is unnecessary.'
It's 5 pm somewhere.

Check warning on line 57 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Prose

dates_times.am_pm.lowercase_periods

'With lowercase letters, the periods are standard.'
It's 12 a.m., time to eat lunch.

Check warning on line 58 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Prose

dates_times.am_pm.midnight_noon

'12 a.m. and 12 p.m. are wrong and confusing. Use 'midnight' or 'noon'.'
It's 11 p.m. at night.

Check warning on line 59 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Prose

dates_times.am_pm.midnight_noon

''a.m.' is always morning; 'p.m.' is always night.'

Check warning on line 59 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Prose

redundancy.nordquist

'Redundancy. Use 'p.m.' instead of 'p.m. at night.'.'
This is a sentence. Two spaces after a period.
centre centre center
$1000 USD

Check warning on line 62 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Spelling

spelling

Word 'USD' is misspelled.
I hit him over the head with a 2 x 4.
A bunch of antelopes walked by the road.
A group of emus attacked me.
She swam by a bunch of oysters.
They hae slain the Earl o' Moray and Lady Mondegreen.

Check warning on line 67 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Spelling

spelling

Word 'hae' is misspelled.

Check warning on line 67 in docs/fail_checks.md

View workflow job for this annotation

GitHub Actions / Check Spelling

spelling

Word 'Mondegreen' is misspelled.
A girl with colitis goes by.
The building is deceptively large.
The project would decimate the fragile wetland wilderness.
Hopefully, one day we will all grow older.
and so I said PLEASE STOP YELLING
so excited!
so excited!!
so excited!!!
so excited!!!!
really??
and so I said PLEASE STOP YELLING
and so I said PLEASE STOP YELLING okay?
THESE ARE SMALL CAPS at the beginning of a new line.
abbreviatable to NASA
academicly superior.
transhipped
an aider and abbeter
it's adducable
let's look for an acquiror
i wonder what tort-feasor means
Get that off of me before I catch on fire!
There are many a person I have met and worked with who simply deride themselves into taking some action
In the meanwhile, he looked loving at the sheep.
Suddenly, I see.
Get ready: button your seatbelts.
The cream rises to the crop.
The biggest bottleneck is that...
he is very smart
approximately about 5 atm machines
atm machine
we associate together
it's blatantly obvious that this obviously works.
a very unique idea

a more perfect union
the surrounding circumstances
he filled a much-needed gap
To coin a phrase from the movie,
Suddenly, the car came to a stop.
All hell broke loose on the farm.


under the weather
He's a chip off the old block
a quantum leap
Our cutting edge decision-making process will make your life crystal clear.
He's a thought leader.
John's cc#:
378282246310005
the password is tnoernturpn
my password is long and 'long'
my password is amazing
inst.
please be advised that
boughten
this obviously works
brb
rofl
We'll need to reconceptualize this sentence.
enplanement
We'll be taking off momentarily.
Save up to 50% or More!
between you and i
I did it on accident
I feel nauseous
It was a highly-anticipated event.
The English speaking people speak English.
A big ticket item.
A right wing militia.
highfaluting
the statement was inadmissable in court
Nikita Khruschev
I feel innundated with email
Nicknack
He's a shoe-in
Brett Farve and Dwayne Wade are good friends.
The Chronicals of Narnia
I did not pay for the check. Honestly, attention to detail is useful.
I did not pay attention to detail.
I did not pay any attention to detail.
The Manchesterian was a good Brit.
One from Michigan is not a Michiganite but a Michigander.
One from Colorado is not a Coloradoan but a Coloradan.
The lady lawyer handled my case.
John and Mary married. Now they are man and wife.
Chairman Mao was the chairman of the communist party.
Smith, et. al (2006) said
John said that I am "very unique."
John knows that I am very unique.
John knows every unique snowflake is cold.
The preceeding discussion
The 'take-home message' is that
more research is needed
The rest of this article argues that, to a certain degree
in recent years, an increasing number of psychologists have
mutatis mutandis
Loading

0 comments on commit 4cc6884

Please sign in to comment.