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

Add codespell support (config, workflow to detect/not fix) and make it fix few typos #701

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
# highlighter.js includes collections of some keywords many of which are partial words or include typos
skip = .git*,.codespellrc,highlighter.js
check-hidden = true
# All caps and some names, super long lines
ignore-regex = \b(Hart|[A-Z]+)\b|.{300,}.*
# ignore-words-list =
25 changes: 25 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Codespell configuration is within .codespellrc
---
name: Codespell

on:
push:
branches: [develop]
pull_request:
branches: [develop]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Annotate locations with typos
uses: codespell-project/codespell-problem-matcher@v1
- name: Codespell
uses: codespell-project/actions-codespell@v2
4 changes: 2 additions & 2 deletions src/remark/components/timer/timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = TimerViewModel;
function TimerViewModel(events, element, options) {
var self = this;

self.options = extend({}, { enabled: true, resetable: true, startOnChange: true, formatter: defaultFormatter }, options || {});
self.options = extend({}, { enabled: true, resettable: true, startOnChange: true, formatter: defaultFormatter }, options || {});
self.element = element;
self.reset();

Expand All @@ -29,7 +29,7 @@ function TimerViewModel(events, element, options) {
});

events.on('resetTimer', function () {
if (self.options.resetable) {
if (self.options.resettable) {
self.reset();
}
});
Expand Down
14 changes: 7 additions & 7 deletions src/remark/highlighter.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ https://highlightjs.org/
}

}(function(hljs) {
// Convenience variables for build-in objects
// Convenience variables for built-in objects
var ArrayProto = [],
objectKeys = Object.keys;

Expand Down Expand Up @@ -3300,7 +3300,7 @@ function(hljs) {
//I don't really know if this is totally relevant
},
{
className: 'title', //symbol would be most accurate however is higlighted just like built_in and that makes up a lot of AutoHotkey code
className: 'title', //symbol would be most accurate however is highlighted just like built_in and that makes up a lot of AutoHotkey code
//meaning that it would fail to highlight anything
variants: [
{begin: '^[^\\n";]+::(?!=)'},
Expand Down Expand Up @@ -9085,7 +9085,7 @@ function(hljs) {

var CONSTRUCTOR = {
className: 'type',
begin: '\\b[A-Z][\\w\']*', // TODO: other constructors (build-in, infix).
begin: '\\b[A-Z][\\w\']*', // TODO: other constructors (built-in, infix).
relevance: 0
};

Expand Down Expand Up @@ -18262,7 +18262,7 @@ function(hljs){
var PS_HELPTAGS = {
className: "doctag",
variants: [
/* no paramater help tags */
/* no parameter help tags */
{
begin: /\.(synopsis|description|example|inputs|outputs|notes|link|component|role|functionality)/
},
Expand Down Expand Up @@ -18315,7 +18315,7 @@ function(hljs){
]
};

// Using statment, plus type, plus assembly name.
// Using statement, plus type, plus assembly name.
var PS_USING = {
begin: /using\s/, end: /$/,
returnBegin: true,
Expand Down Expand Up @@ -23341,7 +23341,7 @@ function(hljs) {
PARAMS
]
},
{ // prevent references like module.id from being higlighted as module definitions
{ // prevent references like module.id from being highlighted as module definitions
begin: /module\./,
keywords: { built_in: 'module' },
relevance: 0
Expand Down Expand Up @@ -24178,7 +24178,7 @@ function(hljs) {
/*
The lookahead pattern (?=...) ensures that 'begin' only matches
'<style' as a single word, followed by a whitespace or an
ending braket. The '$' is needed for the lexeme to be recognized
ending bracket. The '$' is needed for the lexeme to be recognized
by hljs.subMode() that tests lexemes outside the stream.
*/
begin: '<style(?=\\s|>)', end: '>',
Expand Down
2 changes: 1 addition & 1 deletion test/remark/components/timer_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('Timer', function () {
});

it('should respond to a resetTimer event unless \'resetable\' option is set to \'false\'', function () {
timer = new Timer(events, element, { resetable: false });
timer = new Timer(events, element, { resettable: false });

events.emit('startTimer');
events.emit('resetTimer');
Expand Down
2 changes: 1 addition & 1 deletion test/remark/models/slide_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('Slide', function () {
})
, slide = new Slide(1, 1, {
content: [''],
properites: {name: 'b'}
properties: {name: 'b'}
}, template);

slide.content.should.eql(['{{name}}', '']);
Expand Down
4 changes: 2 additions & 2 deletions test/remark/parser_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,14 @@ describe('Parser', function () {
var slides = parser.parse(' 1\n ---\n 2\n ---\n 3');

slides[0].content.should.eql(['1']);
slides[1].content.should.eql([' 2\n']); // Note: lexer includes trailing newines in code blocks
slides[1].content.should.eql([' 2\n']); // Note: lexer includes trailing newlines in code blocks
slides[2].content.should.eql(['3']);
});

it('should preserve leading whitespace that goes beyond the minimum whitespace on the first line', function () {
var slides = parser.parse(' 1\n ---\n 2\n ---\n 3');

slides[0].content.should.eql([' 1\n']); // Note: lexer includes trailing newines in code blocks
slides[0].content.should.eql([' 1\n']); // Note: lexer includes trailing newlines in code blocks
slides[1].content.should.eql(['2']);
slides[2].content.should.eql(['3']);
});
Expand Down