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 (config, workflow) and use it to fix found typos (and some manully) #8173
base: master
Are you sure you want to change the base?
Conversation
bc347bb
to
526c8f3
Compare
ok, I fixed up testing by allowing for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've flagged all the locations where there's a potential behavior change -- we need to either validate that this doesn't change the behavior or that it doesn't cause regressions.
for contraint in table.constraints: | ||
if isinstance(contraint, sqlalchemy.UniqueConstraint): | ||
columns = [column.name for column in contraint.columns] | ||
for constraint in table.constraints: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local variable change -- looks safe
@@ -35,8 +35,8 @@ this.ckan.module('table-toggle-more', function($) { | |||
'</tr>' | |||
].join('\n'); | |||
|
|||
var seperator = $(template_seperator).insertAfter($('.toggle-more:last-child', this.el)); | |||
$(template_more).insertAfter(seperator); | |||
var separator = $(template_seperator).insertAfter($('.toggle-more:last-child', this.el)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks safe, but missed template_seperator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice eye! ;-) moreover that one is present in css and scss. I will fix all of them (current commit c79bade if would not be rebased)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rewritten commit 72aaf40
@@ -1,9 +1,9 @@ | |||
{# | |||
Inserts a stepped progress indicator for the new package form. Each stage can | |||
have one of three states, "uncomplete", "complete" and "active". | |||
have one of three states, "incomplete", "complete" and "active". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This make the documentation incorrect: (lines 16-20 in this file)
{% set s2 = stages[1] or 'uncomplete' %}
{% set dataset_type = dataset_type or h.default_package_type() %}
{% if s1 != 'uncomplete' %}{% set class = 'stage-1' %}{% endif %}
{% if s2 != 'uncomplete' %}{% set class = 'stage-2' %}{% endif %}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced all of them in 3454637 - no more "uncomplete"
s should be found!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rewritten commit is 51bfe61
@@ -474,7 +474,7 @@ def test_example(): | |||
|
|||
class FakeFileStorage(FlaskFileStorage): | |||
def __init__(self, stream: IO[bytes], filename: str): | |||
super(FakeFileStorage, self).__init__(stream, filename, "uplod") | |||
super(FakeFileStorage, self).__init__(stream, filename, "upload") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this relied on anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't it lead to some failed tests? seems to be green now.
@@ -6,7 +6,7 @@ | |||
{{ _('{actor} updated the resource {resource} in the dataset {dataset}').format( | |||
actor=ah.actor(activity), | |||
resource=ah.resource(activity), | |||
dataset=ah.datset(activity) | |||
dataset=ah.dataset(activity) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be an existing bug.
ckanext/activity/tests/test_views.py
Outdated
@@ -51,7 +51,7 @@ def test_simple(self, app): | |||
def test_simple_for_custom_org_type(self, app): | |||
"""Checking the template shows the activity stream.""" | |||
user = factories.User() | |||
org = factories.Organization(user=user, type="grup") | |||
org = factories.Organization(user=user, type="group") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be intentional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok -- I will reorder commits so I skip grup
before I run thorough fixup. It should leave it behind... did that and diff showed indeed only this
❯ git diff enh-codespell..
diff --git a/ckanext/activity/tests/test_views.py b/ckanext/activity/tests/test_views.py
index c7bf87a46..ce2e7584f 100644
--- a/ckanext/activity/tests/test_views.py
+++ b/ckanext/activity/tests/test_views.py
@@ -51,7 +51,7 @@ class TestOrganization(object):
def test_simple_for_custom_org_type(self, app):
"""Checking the template shows the activity stream."""
user = factories.User()
- org = factories.Organization(user=user, type="group")
+ org = factories.Organization(user=user, type="grup")
url = url_for("activity.organization_activity", id=org["id"])
response = app.get(url)
@@ -27,7 +27,7 @@ def test_translated_string_in_core_templates(self, app): | |||
url=plugins.toolkit.url_for(u"home.index", locale="fr"), | |||
) | |||
assert helpers.body_contains(response, "Overwritten string in ckan.mo") | |||
assert not helpers.body_contains(response, "Connexion") | |||
assert not helpers.body_contains(response, "Connection") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be changing the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rright... and talks about "fr" for which it is correct I guess:
❯ git grep -a Connexion
ckan/i18n/fr/LC_MESSAGES/ckan.mo:ckan/i18n/fr/LC_MESSAGES/ckan.po:msgstr "Connexion"
❯ git grep Connexion
Binary file ckan/i18n/fr/LC_MESSAGES/ckan.mo matches
ckan/i18n/fr/LC_MESSAGES/ckan.po:msgstr "Connexion"
I will need to add pragma to skip this line and rerun "fixups"...
It was mentioned on the dev call that depending on how we're feeling about adding code to the actions and the security implications -- we may just want to accept the spelling changes and deal with the ongoing maintenance in a separate PR. |
up to you -- I can easily pull out the workflow if so desired. Note that it has permissions:
contents: read and no secrets explicitly exposed -- should be safe IMHO (shouldn't push etc). I guess there could still be a malicious vector of attack -- me, since IIRC next time "I" [*] submit a PR against this workflow (may be adding some secrets leaking?) -- they could be exposed? Or what other vector do you foresee? [*] "I" could be an attacker using my stolen account? |
…ut ignoring the failure due to ambigous typos === Do not change lines below === { "chain": [ "3e69bc9d304d2a3ab16238c591c9a85e65d152aa", "e71e761523037c3d9b505fb42fbcf3be3a7118e4" ], "cmd": "codespell -w || :", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^
=== Do not change lines below === { "chain": [ "e96808eedb54d367087e495c7c0d279cca32362e" ], "cmd": "codespell -w -i 3 -C 2", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^
…css, scss, js === Do not change lines below === { "chain": [], "cmd": "git-sedi seperator separator", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^
…' -- also in css, scss, js === Do not change lines below === { "chain": [], "cmd": "git-sedi uncomplete incomplete", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^
526c8f3
to
51bfe61
Compare
Thank you @EricSoroos for the review! ok, pushed rebase with additional fixes and reran of the codespell to not affect mentioned above Overall diff from old version to current one (although also available in github interface in "Compare")diff --git a/ckan/public/base/css/main-rtl.css b/ckan/public/base/css/main-rtl.css
index fb7ef9656..4ba76877d 100644
--- a/ckan/public/base/css/main-rtl.css
+++ b/ckan/public/base/css/main-rtl.css
@@ -13642,13 +13642,13 @@ td.diff_header {
.js .table-toggle-more .show-less {
display: none;
}
-.js .table-toggle-more .toggle-seperator {
+.js .table-toggle-more .toggle-separator {
display: table-row;
}
-.js .table-toggle-more .toggle-seperator td {
+.js .table-toggle-more .toggle-separator td {
height: 11px;
padding: 0;
- background-image: url("../../../base/images/table-seperator.png");
+ background-image: url("../../../base/images/table-separator.png");
}
.js .table .toggle-show td {
background: none;
@@ -13660,7 +13660,7 @@ td.diff_header {
.js .table-toggle-less .show-more {
display: none;
}
-.js .table-toggle-less .toggle-seperator {
+.js .table-toggle-less .toggle-separator {
display: none;
}
diff --git a/ckan/public/base/css/main.css b/ckan/public/base/css/main.css
index c139ff91e..144d95503 100644
--- a/ckan/public/base/css/main.css
+++ b/ckan/public/base/css/main.css
@@ -13642,13 +13642,13 @@ td.diff_header {
.js .table-toggle-more .show-less {
display: none;
}
-.js .table-toggle-more .toggle-seperator {
+.js .table-toggle-more .toggle-separator {
display: table-row;
}
-.js .table-toggle-more .toggle-seperator td {
+.js .table-toggle-more .toggle-separator td {
height: 11px;
padding: 0;
- background-image: url("../../../base/images/table-seperator.png");
+ background-image: url("../../../base/images/table-separator.png");
}
.js .table .toggle-show td {
background: none;
@@ -13660,7 +13660,7 @@ td.diff_header {
.js .table-toggle-less .show-more {
display: none;
}
-.js .table-toggle-less .toggle-seperator {
+.js .table-toggle-less .toggle-separator {
display: none;
}
diff --git a/ckan/public/base/javascript/modules/table-toggle-more.js b/ckan/public/base/javascript/modules/table-toggle-more.js
index 90fd7302f..99e3b51ea 100644
--- a/ckan/public/base/javascript/modules/table-toggle-more.js
+++ b/ckan/public/base/javascript/modules/table-toggle-more.js
@@ -28,14 +28,14 @@ this.ckan.module('table-toggle-more', function($) {
'</td>',
'</tr>'
].join('\n');
- var template_seperator = [
- '<tr class="toggle-seperator">',
+ var template_separator = [
+ '<tr class="toggle-separator">',
'<td colspan="'+cols+'">',
'</td>',
'</tr>'
].join('\n');
- var separator = $(template_seperator).insertAfter($('.toggle-more:last-child', this.el));
+ var separator = $(template_separator).insertAfter($('.toggle-more:last-child', this.el));
$(template_more).insertAfter(separator);
$('.show-more', this.el).on('click', this._onShowMore);
diff --git a/ckan/public/base/scss/_tables.scss b/ckan/public/base/scss/_tables.scss
index 2ba5b5433..4a160be47 100644
--- a/ckan/public/base/scss/_tables.scss
+++ b/ckan/public/base/scss/_tables.scss
@@ -43,12 +43,12 @@
.show-less {
display: none;
}
- .toggle-seperator {
+ .toggle-separator {
display: table-row;
td {
height: 11px;
padding: 0;
- background-image: url("#{$imagePath}/table-seperator.png");
+ background-image: url("#{$imagePath}/table-separator.png");
}
}
}
@@ -63,7 +63,7 @@
.show-more {
display: none;
}
- .toggle-seperator {
+ .toggle-separator {
display: none;
}
}
diff --git a/ckan/public/base/vendor/jquery.js b/ckan/public/base/vendor/jquery.js
index fc6c299b7..248b5ac16 100644
--- a/ckan/public/base/vendor/jquery.js
+++ b/ckan/public/base/vendor/jquery.js
@@ -3991,7 +3991,7 @@ jQuery.extend( {
when: function( singleValue ) {
var
- // count of uncompleted subordinates
+ // count of incompleted subordinates
remaining = arguments.length,
// count of unprocessed arguments
diff --git a/ckan/templates/package/snippets/stages.html b/ckan/templates/package/snippets/stages.html
index 5ec0d024d..0dfe18f59 100644
--- a/ckan/templates/package/snippets/stages.html
+++ b/ckan/templates/package/snippets/stages.html
@@ -13,11 +13,11 @@ Example:
#}
{% set s1 = stages[0] or 'active' %}
-{% set s2 = stages[1] or 'uncomplete' %}
+{% set s2 = stages[1] or 'incomplete' %}
{% set dataset_type = dataset_type or h.default_package_type() %}
-{% if s1 != 'uncomplete' %}{% set class = 'stage-1' %}{% endif %}
-{% if s2 != 'uncomplete' %}{% set class = 'stage-2' %}{% endif %}
+{% if s1 != 'incomplete' %}{% set class = 'stage-1' %}{% endif %}
+{% if s2 != 'incomplete' %}{% set class = 'stage-2' %}{% endif %}
<ol class="stages {{ class }}">
<li class="first {{ s1 }}">
diff --git a/ckanext/activity/tests/test_views.py b/ckanext/activity/tests/test_views.py
index c7bf87a46..ce2e7584f 100644
--- a/ckanext/activity/tests/test_views.py
+++ b/ckanext/activity/tests/test_views.py
@@ -51,7 +51,7 @@ class TestOrganization(object):
def test_simple_for_custom_org_type(self, app):
"""Checking the template shows the activity stream."""
user = factories.User()
- org = factories.Organization(user=user, type="group")
+ org = factories.Organization(user=user, type="grup")
url = url_for("activity.organization_activity", id=org["id"])
response = app.get(url)
diff --git a/ckanext/example_itranslation/tests/test_plugin.py b/ckanext/example_itranslation/tests/test_plugin.py
index 01822c04a..8ce4a7ecd 100644
--- a/ckanext/example_itranslation/tests/test_plugin.py
+++ b/ckanext/example_itranslation/tests/test_plugin.py
@@ -27,7 +27,7 @@ class TestExampleITranslationPlugin(object):
url=plugins.toolkit.url_for(u"home.index", locale="fr"),
)
assert helpers.body_contains(response, "Overwritten string in ckan.mo")
- assert not helpers.body_contains(response, "Connection")
+ assert not helpers.body_contains(response, "Connexion") # codespell-ignore
# double check the untranslated strings
response = app.get(url=plugins.toolkit.url_for(u"home.index"),) |
=== Do not change lines below === { "chain": [], "cmd": "git mv ./ckan/public/base/images/table-seperator.png ./ckan/public/base/images/table-separator.png", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^
height: 11px; | ||
padding: 0; | ||
background-image: url("../../../base/images/table-seperator.png"); | ||
background-image: url("../../../base/images/table-separator.png"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just now mentioned this. Pushed separate ea3c259 to rename the file as well.
interesting, test failed but a bit surprising - no changes in related test, and test body looks like it should have better passed:
a flaky test? I will accept my suggestion in #8173 (comment) and thus trigger rerun... |
indeed a known issue - #6537 . FWIW in recent con/tinuous downloaded logs for the past week this one was the only failure:
here is tinuous configuration I have used for `tinuous fetch`.. seems support for circle-ci could still be improvedrepo: ckan/ckan
vars:
path_prefix: '{year}//{month}//{day}/{type}/{type_id}/{commit[:7]}/{ci}-'
common_path: '{path_prefix}{wf_name}-{number}-{common_status}/'
ci:
github:
paths:
logs: '{common_path}'
artifacts: '{common_path}'
releases: 'releases/{release_tag}'
circleci:
paths:
logs: '{common_path}{job_name}/{step}-{index}.txt'
since: 2024-04-08T00:00:00Z
types: [cron, pr, push, manual]
datalad:
enabled: true
cfg_proc: text2git |
Proposed fixes:
Make ckan typo free. I had to change some variable names in some tests IIRC but overall I think there should be no effect on functionality.
Features:
Please [X] all the boxes above that apply