Add codespell support #1770

Merged
merged 13 commits into from Nov 29, 2017
View
@@ -15,6 +15,8 @@ jobs:
- stage: static
if: type != cron
script: sudo ./tools/travis/run_tests.sh static
+ - if: type != cron
+ script: sudo ./tools/travis/run_codespell.sh
- stage: unit
if: type != cron
script: sudo ./tools/travis/run_tests.sh snapcraft/tests/unit
@@ -36,7 +38,7 @@ jobs:
script: sudo ./tools/travis/run_tests.sh snapcraft/tests/integration/containers
- if: type != cron
script: sudo ./tools/travis/run_tests.sh snapcraft/tests/integration/snapd
- # CLA check, only in pull requests, not comming from the bot.
+ # CLA check, only in pull requests, not coming from the bot.
- if: type = pull_request AND sender != snappy-m-o
script: ./tools/travis/run_cla_check.sh
# Trigger nightly tests, only in cron.
View
@@ -25,13 +25,13 @@ The static tests suite performs a static analysis on the source code without exe
### Unit tests
-The unit tests is a suite of low-level white box tests. They excercise units of code to verify that the different parts work as expected in a fully isolated way. Ideally, these tests should call only public functions, objects and methods, leaving the internals of snapcraft as implementation details that can change without having to modifying any tests. To isolate the units from their environment and dependencies we can replace those with test doubles. In order to set up test doubles, we prefer dependency injection through arguments than excessive mocking. These tests can verify the results checking the output printed to the command line, checking the files created during the excecution, inspecting the calls made to the test doubles and verifying that the expected exceptions were thrown.
+The unit tests is a suite of low-level white box tests. They exercise units of code to verify that the different parts work as expected in a fully isolated way. Ideally, these tests should call only public functions, objects and methods, leaving the internals of snapcraft as implementation details that can change without having to modifying any tests. To isolate the units from their environment and dependencies we can replace those with test doubles. In order to set up test doubles, we prefer dependency injection through arguments than excessive mocking. These tests can verify the results checking the output printed to the command line, checking the files created during the execution, inspecting the calls made to the test doubles and verifying that the expected exceptions were thrown.
These tests are in the `snapcraft/tests/unit` directory.
### Integration tests
-The integration tests are a group of suites that excercise snapcraft as a black box. They are only allowed to set up the environment where snapcraft runs and create files; but for the execution phase of the test they can only run the snapcraft command or one of its subcommands. To verify the results they can check the output printed to the command line, the return value of the snapcraft command, and any files created during the execution.
+The integration tests are a group of suites that exercise snapcraft as a black box. They are only allowed to set up the environment where snapcraft runs and create files; but for the execution phase of the test they can only run the snapcraft command or one of its subcommands. To verify the results they can check the output printed to the command line, the return value of the snapcraft command, and any files created during the execution.
These tests are in the `snapcraft/tests/integration` directory, with the `snapcraft.yamls` and other source files for the tests snaps in `snapcraft/tests/integration/snaps`.
View
@@ -51,7 +51,7 @@ snapcraft (2.35) xenial; urgency=medium
* many: account for python shebang args in rewrite
[ Leo Arias ]
- * typo: replace occured with occurred
+ * typo: replace ocurred with occurred
* node plugin: record installed node packages in manifest
* node plugin: record the yarn.lock file
* tests: fix the TEST_STORE environment variable
@@ -295,7 +295,7 @@ snapcraft (2.33) xenial; urgency=medium
* core: clean the container on a full clean (#1372)
* lxd: do not assume user ID of 1000 for raw.idmap (#1385)
* autotools plugin: Enable cross-compilation support (#1383)
- * lxd: distingish FileNotFoundError for when not installed (#1400)
+ * lxd: distinguish FileNotFoundError for when not installed (#1400)
* waf plugin: enable cross-compilation support (#1397)
* ci: wait for apt/dpkg lock when setting lxd up (#1421)
* lxd: stop setting `$HOME` in containers (#1408)
@@ -614,7 +614,7 @@ snapcraft (2.27.1) xenial; urgency=medium
snapcraft (2.27) xenial; urgency=medium
[ Sergio Schvezov ]
- * core: switch to using rpath for clasic confinement. (#1094)
+ * core: switch to using rpath for classic confinement. (#1094)
* python plugin: do the right thing with classic. (#1093)
* meta: support for the environment keyword. (#1103)
* meta: correct the deprecation for `setup/gui` use. (#1107)
View
@@ -23,7 +23,7 @@
You tell snapcraft which build system it must drive by specifying the
snapcraft plugin for that part. Every part must specify a plugin explicitly
-(when you see a part that does not specify a plugin, thats because the
+(when you see a part that does not specify a plugin, that's because the
actual part definition is in the cloud, where the plugin is specified!)
These plugins implement a lifecycle over the following steps:
View
@@ -224,7 +224,7 @@ def __init__(self, use_geoip=False, parallel_builds=True,
self.__debug = debug
def get_core_dynamic_linker(self):
- """Returns the dynamic linker used for the targetted core.
+ """Returns the dynamic linker used for the targeted core.
If not found realpath for `/lib/ld-linux.so.2` is returned.
However if core is not installed None will be returned.
"""
@@ -108,7 +108,7 @@ def determine_ld_library_path(root: str) -> List[str]:
:param root str: the root directory to search for specific ld.so.conf
entries.
:returns: a list of strings of library paths where releavant libraries
- can be found withing root.
+ can be found within root.
"""
# If more ld.so.conf files need to be supported, add them here.
ld_config_globs = {
@@ -55,7 +55,7 @@
logger = logging.getLogger(__name__)
-# TODO: make this a temporary directory that get's removed when finished
+# TODO: make this a temporary directory that gets removed when finished
BASE_DIR = os.path.join(BaseDirectory.xdg_cache_home, 'snapcraft-parser')
PARTS_FILE = 'snap-parts.yaml'
DEFAULT_INDEX = 'http://wiki.ubuntu.com/snapcraft/parts?action=raw'
@@ -74,7 +74,7 @@ def _parse_dict(section, statement, statements, project_options,
for key, value in section.items():
if _ON_CLAUSE_PATTERN.match(key):
- # We've come across the begining of an 'on' statement.
+ # We've come across the beginning of an 'on' statement.
# That means any previous statement we found is complete.
# The first time through this may be None, but the
# collection will ignore it.
@@ -85,7 +85,7 @@ def _parse_dict(section, statement, statements, project_options,
checker=checker)
if _TRY_CLAUSE_PATTERN.match(key):
- # We've come across the begining of a 'try' statement.
+ # We've come across the beginning of a 'try' statement.
# That means any previous statement we found is complete.
# The first time through this may be None, but the
# collection will ignore it.
@@ -312,7 +312,7 @@ def env(self, root):
'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:{}'.format(ld_library_path),
]
- # There's a chicken and egg problem here, everything run get's an
+ # There's a chicken and egg problem here, everything run gets an
# env built, even package installation, so the first runs for these
# will likely fail.
try:
@@ -34,7 +34,7 @@ class RefreshCommandBaseTestCase(CommandBaseTestCase, TestWithFakeRemoteParts):
name: snap-test
version: 1.0
summary: test snapping
- description: if snap is succesful a snap package will be available
+ description: if snap is successful a snap package will be available
architectures: ['amd64']
type: {}
confinement: strict
@@ -2,7 +2,7 @@ name: dep-tree
summary: A tree of things to make sure work
description: |
A snapcraft.yaml that has a relatively complex tree of
- dependencies that can stress test the depedency resolution
+ dependencies that can stress test the dependency resolution
code in Snapcraft.
version: 1.0
confinement: strict
@@ -29,7 +29,7 @@ public static Test suite()
}
/**
- * Rigourous Test :-)
+ * Rigorous Test :-)
*/
public void testApp()
{
@@ -6,7 +6,7 @@ _name: Simple
unit: job
id: missing-command-job
category_id: simple
-_summary: A job defintion that is missing a command field
+_summary: A job definition that is missing a command field
_description:
This test is intentionally defined with a missing command field. This will
cause the validate step to fail during build.
@@ -2,4 +2,4 @@
static const int truc=5;
void foo() { }
-void _internal() {} /* this one is not gonna be exported by *.def */
+void _internal() {} /* this one is not going to be exported by *.def */
@@ -87,7 +87,7 @@ class LifecycleCommandsBaseTestCase(CommandBaseTestCase):
yaml_template = """name: {step}-test
version: 1.0
summary: test {step}
-description: if the {step} is succesful the state file will be updated
+description: if the {step} is successful the state file will be updated
confinement: strict
grade: stable
@@ -30,7 +30,7 @@ class CleanCommandTestCase(CommandBaseTestCase):
yaml_template = """name: clean-test
version: 1.0
summary: test clean
-description: if the clean is succesful the state file will be updated
+description: if the clean is successful the state file will be updated
icon: icon.png
confinement: strict
grade: stable
@@ -40,7 +40,7 @@ def setUp(self):
name: snap-test
version: 1.0
summary: test cleanbuild
- description: if snap is succesful a snap package will be available
+ description: if snap is successful a snap package will be available
architectures: ['amd64']
confinement: strict
grade: stable
@@ -42,7 +42,7 @@ class SnapCommandBaseTestCase(CommandBaseTestCase):
name: snap-test
version: 1.0
summary: test snapping
- description: if snap is succesful a snap package will be available
+ description: if snap is successful a snap package will be available
architectures: ['amd64']
type: {}
confinement: strict
@@ -37,7 +37,7 @@ class UpdateCommandTestCase(CommandBaseTestCase, unit.TestWithFakeRemoteParts):
name: snap-test
version: 1.0
summary: test snapping
- description: if snap is succesful a snap package will be available
+ description: if snap is successful a snap package will be available
architectures: ['amd64']
type: app
confinement: strict
@@ -501,12 +501,12 @@ def test_register_without_login_raises_exception(self):
def test_register_name_successfully(self):
self.client.login('dummy', 'test correct password')
- # No exception will be raised if this is succesful
+ # No exception will be raised if this is successful
self.client.register('test-good-snap-name')
def test_register_private_name_successfully(self):
self.client.login('dummy', 'test correct password')
- # No exception will be raised if this is succesful
+ # No exception will be raised if this is successful
self.client.register('test-good-snap-name', is_private=True)
def test_register_refreshes_macaroon(self):
@@ -530,7 +530,7 @@ class EnsureFilePathsTestCase(CreateBaseTestCase):
scenarios = [
('desktop', dict(
- filepath='usr/share/dekstop/desktop.desktop',
+ filepath='usr/share/desktop/desktop.desktop',
content='[Desktop Entry]\nExec=app2.exe\nIcon=/usr/share/app2.png',
key='desktop')),
('completer', dict(
@@ -552,7 +552,7 @@ class EnsureFilePathsTestCaseFails(CreateBaseTestCase):
scenarios = [
('desktop', dict(
- filepath='usr/share/dekstop/desktop.desktop',
+ filepath='usr/share/desktop/desktop.desktop',
key='desktop')),
('completer', dict(
filepath='usr/share/completions/complete.sh',
@@ -0,0 +1,4 @@
+#!/bin/sh
+set -e
+sudo pip install codespell
+codespell -S "*.xz,*.zip,*.bz2,*.7z,*.gz,*.deb,*.rpm,*.snap,*.gpg,*.pyc,*.png,*.ico,*.jar,./.git,changelog" -q4