Skip to content

Commit ef6a6ad

Browse files
authored
Merge pull request #40 from adambullmer/pipenv
Pipenv
2 parents e71aabf + 2746fd4 commit ef6a6ad

29 files changed

+467
-55
lines changed

.coveragerc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[run]
2+
omit =
3+
*/__main__.py
4+
tests/*
5+
__init__.py
File renamed without changes.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
.tox
22
*.sublime-package
3+
pytest
4+
.coverage

DocblockrPython.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
def plugin_loaded():
17-
"""The Sublime Text 3 entry point for plugins."""
17+
"""Sublime Text 3 entry point for plugins."""
1818
populate_registry()
1919

2020
global plugin_is_loaded

Pipfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[[source]]
2+
name = "pypi"
3+
url = "https://pypi.org/simple"
4+
verify_ssl = true
5+
6+
[dev-packages]
7+
tox = "*"
8+
flake8 = "*"
9+
pytest = "*"
10+
pytest-cov = "*"
11+
pytest-sugar = "*"
12+
pydocstyle = "*"
13+
14+
[packages]
15+
16+
[requires]
17+
python_version = "3.4.3"

Pipfile.lock

Lines changed: 243 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,53 @@ class MyFormatter(Base):
7777
**Note:** The console should yell at you if you didn't write all the abstract methods. Be sure to read the docs on the `Base` formatter
7878
to make sure you understand all the caveats of each formatter function.
7979

80+
Local Development
81+
-----------------
82+
83+
Below are the instructions to work on this repo locally.
84+
85+
1. Clone the repo.
86+
1. Uninstall the plugin from sublime text.
87+
1. Symlink the github repo into your sublime text packages directory.
88+
- Debian example:
89+
```bash
90+
ln -s <absolute/path/to/github/repo/sublime_docblockr_python> $HOME/.config/sublime-text-3/Packages/Docblockr_Python
91+
```
92+
1. There are no runtime dependencies
93+
1. Pay attention to the sublime console ```ctrl + ` ```
94+
95+
96+
Testing Changes
97+
---------------
98+
99+
In addition to the setup instructions above, testing will require additinoal setup.
100+
101+
**System Requirements:**
102+
- [pyenv](https://github.com/pyenv/pyenv)
103+
- [pipenv](https://pipenv.readthedocs.io/en/latest/)
104+
105+
**Setup:**
106+
1. Install depedencies through pipenv `pipenv install --dev`
107+
1. Run unit tests `pipenv run tox`
108+
- [py.test](https://docs.pytest.org/en/latest/) unit tests
109+
- [flake8](http://flake8.pycqa.org/en/latest/) linting
110+
- [pydocstyle](http://www.pydocstyle.org/en/2.1.1/) (formerly PEP257) docstring checker
111+
80112

81113
Known Issues
82114
------------
83115
- Only detects closed docstring if it is on a line of the same indentation, and has no text in front of it. Single Line docstrings are converted to block
116+
- The tests run in python `3.4.3`, however sublime's python version is `3.3.6`. This is due to the difficulty of getting a working version of 3.3.6 in a dev environment, and the differences should be minimal.
84117

85118

86119
Roadmap
87120
-------
88121
Things I want to do wtih this project. Not necessarily an exhaustive or prioritized list.
89122

90123
- Unit Tests!
124+
- Needs a test harness of some sort for sublime internals.
125+
- CI, probably circleci
126+
- Coverage reporting
91127
- More completions!
92128
- Javadoc style formatter
93129
- Keyboard Shortcuts

__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Docblockr Python."""

commands.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def escape(string):
4343
4444
Returns:
4545
{String} String with escaped characters
46+
4647
"""
4748
return string.replace('$', r'\$').replace('{', r'\{').replace('}', r'\}')
4849

@@ -101,7 +102,7 @@ def run(self, edit):
101102
write(self.view, snippet)
102103

103104
def initialize(self, view):
104-
"""Setup the command's settings.
105+
"""Set up the command's settings.
105106
106107
Begins preparsing the file to gather some basic information.
107108
- Which parser to use
@@ -141,6 +142,7 @@ def create_snippet(self, parsed_attributes):
141142
142143
Returns:
143144
str -- sublime text formatted snippet string
145+
144146
"""
145147
project_formatter = self.project_settings.get('formatter', None)
146148
formatter = get_formatter(project_formatter or get_setting('formatter'))()

parsers/parser.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,9 @@ def process_variable(self, variable, hints=None):
413413
params['default'] = pieces[1].strip()
414414

415415
params['name'] = variable
416-
params['type'] = hints.get(variable, None) or guess_type_from_value(params.get('default')) or guess_type_from_name(variable)
416+
params['type'] = hints.get(variable, None) or \
417+
guess_type_from_value(params.get('default')) or \
418+
guess_type_from_name(variable)
417419

418420
return params
419421

0 commit comments

Comments
 (0)