diff --git a/docs/config/config-file.md b/docs/config/config-file.md index 099c804..5754516 100644 --- a/docs/config/config-file.md +++ b/docs/config/config-file.md @@ -335,7 +335,7 @@ Dotdrop should be able to handle `toml` config file however this feature hasn't been extensively tested. A base [config.toml](/config.toml) is available to get started. -The script [yaml-to-toml.py](https://github.com/deadc0de6/dotdrop/blob/master/scripts/yaml-to-toml.py) allows to convert a `yaml` dotdrop +The script [yaml_to_toml.py](https://github.com/deadc0de6/dotdrop/blob/master/scripts/yaml_to_toml.py) allows to convert a `yaml` dotdrop config file to `toml`. For more see issue [#343](https://github.com/deadc0de6/dotdrop/issues/343). \ No newline at end of file diff --git a/scripts/change-link.py b/scripts/change_link.py similarity index 97% rename from scripts/change-link.py rename to scripts/change_link.py index f06a580..f063027 100755 --- a/scripts/change-link.py +++ b/scripts/change_link.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# pylint: disable-msg=C0103 """ author: deadc0de6 (https://github.com/deadc0de6) Copyright (c) 2018, deadc0de6 diff --git a/scripts/check-syntax.sh b/scripts/check-syntax.sh index 52a4594..272b598 100755 --- a/scripts/check-syntax.sh +++ b/scripts/check-syntax.sh @@ -67,7 +67,7 @@ find . -name "*.py" -not -path "./dotdrop/*" | while read -r script; do --disable=R0914 \ --disable=R0915 \ --disable=R0913 \ - --disable=R0201 \ + --load-plugins pylint.extensions.no_self_use \ "${script}" done diff --git a/scripts/check-tests-ng.sh b/scripts/check-tests-ng.sh index 3905d4e..5d46681 100755 --- a/scripts/check-tests-ng.sh +++ b/scripts/check-tests-ng.sh @@ -32,13 +32,13 @@ workdir_tmp_exists="no" if [ -z "${GITHUB_WORKFLOW}" ]; then ## local export COVERAGE_FILE= - tests-ng/tests-launcher.py + tests-ng/tests_launcher.py else ## CI/CD export COVERAGE_FILE="${cur}/.coverage" # running multiple jobs in parallel sometimes # messes with the results on remote servers - tests-ng/tests-launcher.py 1 + tests-ng/tests_launcher.py 1 fi # clear workdir diff --git a/scripts/yaml-to-toml.py b/scripts/yaml_to_toml.py similarity index 97% rename from scripts/yaml-to-toml.py rename to scripts/yaml_to_toml.py index c92ada7..0185a15 100755 --- a/scripts/yaml-to-toml.py +++ b/scripts/yaml_to_toml.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# pylint: disable-msg=C0103 """ author: deadc0de6 (https://github.com/deadc0de6) Copyright (c) 2022, deadc0de6 diff --git a/tests-ng/tests-launcher.py b/tests-ng/tests_launcher.py similarity index 97% rename from tests-ng/tests-launcher.py rename to tests-ng/tests_launcher.py index 3a509b0..bdb231f 100755 --- a/tests-ng/tests-launcher.py +++ b/tests-ng/tests_launcher.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# pylint: disable-msg=C0103 """ author: deadc0de6 (https://github.com/deadc0de6) Copyright (c) 2020, deadc0de6 @@ -15,7 +14,7 @@ from concurrent import futures from halo import Halo -LOG_FILE = '/tmp/dotdrop-tests-launcher.log' +LOG_FILE = '/tmp/dotdrop-tests_launcher.log' GITHUB_ENV = 'GITHUB_WORKFLOW' diff --git a/tests/test_install.py b/tests/test_install.py index c5b17fb..2edf4f5 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -21,6 +21,42 @@ from dotdrop.utils import header from dotdrop.linktypes import LinkTypes +def fake_config(path, dotfiles, profile, + dotpath, actions, transs): + """Create a fake config file""" + with open(path, 'w', encoding='utf-8') as file: + file.write('actions:\n') + for action in actions: + file.write(f' {action.key}: {action.action}\n') + file.write('trans:\n') + for trans in transs: + file.write(f' {trans.key}: {trans.action}\n') + file.write('config:\n') + file.write(' backup: true\n') + file.write(' create: true\n') + file.write(f' dotpath: {dotpath}\n') + file.write('dotfiles:\n') + for dotfile in dotfiles: + linkval = dotfile.link.name.lower() + file.write(f' {dotfile.key}:\n') + file.write(f' dst: {dotfile.dst}\n') + file.write(f' src: {dotfile.src}\n') + file.write(f' link: {linkval}\n') + if len(dotfile.actions) > 0: + file.write(' actions:\n') + for action in dotfile.actions: + file.write(f' - {action.key}\n') + if dotfile.trans_r: + for trans in dotfile.trans_r: + file.write(f' trans_read: {trans.key}\n') + file.write('profiles:\n') + file.write(f' {profile}:\n') + file.write(' dotfiles:\n') + for dotfile in dotfiles: + file.write(f' - {dotfile.key}\n') + return path + + class TestInstall(unittest.TestCase): """test case""" @@ -39,41 +75,6 @@ exec bspwm exec bspwm ''' - def fake_config(self, path, dotfiles, profile, - dotpath, actions, transs): - """Create a fake config file""" - with open(path, 'w', encoding='utf-8') as file: - file.write('actions:\n') - for action in actions: - file.write(f' {action.key}: {action.action}\n') - file.write('trans:\n') - for trans in transs: - file.write(f' {trans.key}: {trans.action}\n') - file.write('config:\n') - file.write(' backup: true\n') - file.write(' create: true\n') - file.write(f' dotpath: {dotpath}\n') - file.write('dotfiles:\n') - for dotfile in dotfiles: - linkval = dotfile.link.name.lower() - file.write(f' {dotfile.key}:\n') - file.write(f' dst: {dotfile.dst}\n') - file.write(f' src: {dotfile.src}\n') - file.write(f' link: {linkval}\n') - if len(dotfile.actions) > 0: - file.write(' actions:\n') - for action in dotfile.actions: - file.write(f' - {action.key}\n') - if dotfile.trans_r: - for trans in dotfile.trans_r: - file.write(f' trans_read: {trans.key}\n') - file.write('profiles:\n') - file.write(f' {profile}:\n') - file.write(' dotfiles:\n') - for dotfile in dotfiles: - file.write(f' - {dotfile.key}\n') - return path - def test_install(self): """Test the install function""" @@ -186,8 +187,8 @@ exec bspwm dotfiles = [dotfile1, dotfile2, dotfile3, dotfile4, dotfile5, dotfile6, dotfile7, dotfile8, dotfile9, dotfile10, ddot] - self.fake_config(confpath, dotfiles, - profile, tmp, [act1], [the_trans]) + fake_config(confpath, dotfiles, + profile, tmp, [act1], [the_trans]) conf = Cfg(confpath, profile, debug=True) self.assertTrue(conf is not None) diff --git a/tests/test_jhelpers.py b/tests/test_jhelpers.py index df57a3d..00d07bf 100644 --- a/tests/test_jhelpers.py +++ b/tests/test_jhelpers.py @@ -14,6 +14,24 @@ from dotdrop.dotfile import Dotfile from dotdrop.dotdrop import cmd_install +def fake_config(path, dotfile, profile, dotpath): + """Create a fake config file""" + with open(path, 'w', encoding='utf-8') as file: + file.write('config:\n') + file.write(' backup: true\n') + file.write(' create: true\n') + file.write(f' dotpath: {dotpath}\n') + file.write('dotfiles:\n') + file.write(f' {dotfile.key}:\n') + file.write(f' dst: {dotfile.dst}\n') + file.write(f' src: {dotfile.src}\n') + file.write('profiles:\n') + file.write(f' {profile}:\n') + file.write(' dotfiles:\n') + file.write(f' - {dotfile.key}\n') + return path + + class TestJhelpers(unittest.TestCase): """test case""" @@ -56,23 +74,6 @@ basename: c dirname: /tmp/a/b ''' - def fake_config(self, path, dotfile, profile, dotpath): - """Create a fake config file""" - with open(path, 'w', encoding='utf-8') as file: - file.write('config:\n') - file.write(' backup: true\n') - file.write(' create: true\n') - file.write(f' dotpath: {dotpath}\n') - file.write('dotfiles:\n') - file.write(f' {dotfile.key}:\n') - file.write(f' dst: {dotfile.dst}\n') - file.write(f' src: {dotfile.src}\n') - file.write('profiles:\n') - file.write(f' {profile}:\n') - file.write(' dotfiles:\n') - file.write(f' - {dotfile.key}\n') - return path - def test_jhelpers(self): """Test the install function""" @@ -96,7 +97,7 @@ dirname: /tmp/a/b # generate the config and stuff profile = get_string(5) confpath = os.path.join(tmp, self.CONFIG_NAME) - self.fake_config(confpath, dotfile1, profile, tmp) + fake_config(confpath, dotfile1, profile, tmp) conf = CfgAggregator(confpath, profile, debug=True) self.assertTrue(conf is not None)