Skip to content

Commit

Permalink
v0.1.1 - Fix comment indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolCat467 authored Feb 14, 2022
1 parent e3add39 commit 43b7aa7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

here = pathlib.Path(__file__).parent.resolve()

version = '0.1.0'
version = '0.1.1'
# Get the long description from the README file
long_description = (here / 'README.md').read_text(encoding='utf-8')
install_requires = ['pylint']
Expand Down
18 changes: 8 additions & 10 deletions src/lintcheck/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

__title__ = 'lintcheck'
__author__ = 'CoolCat467'
__version__ = '0.1.0'
__license__ = 'GPLv3'
__version__ = '0.1.1'
__ver_major__ = 0
__ver_minor__ = 1
__ver_patch__ = 0
__ver_patch__ = 1

import os
import json
Expand Down Expand Up @@ -187,20 +188,17 @@ def add_comment(self, message):
msg = message['message']

# Go to line pylint is talking about
self.editwin.gotoline(max(0, line-1))
## self.flist.gotofileline(file, max(0, line-1))
self.editwin.gotoline(line)
## self.flist.gotofileline(file, line-1)
# Get format region
head, tail, chars, lines = self.formatter.get_region()
# If there is already a pylint from us comment there, ignore that line.
if self.comment in chars:
return
# Figure out line indent
indent_match_idx = len(lines)-2 if len(lines) > 1 else 0
indent = get_line_indent(lines[indent_match_idx])
# Set last line of section (empty) to pylint message in a comment
lines[-1] = ' '*indent+self.comment+symbol+' ('+msg_id+'): '+msg
# Re-add empty line so we don't break text around comment
lines.append('')
indent = get_line_indent(lines[0])
# Add comment line
lines = [' '*indent+self.comment+symbol+' ('+msg_id+'): '+msg] + lines
# Save changes
self.formatter.set_region(head, tail, chars, lines)

Expand Down

0 comments on commit 43b7aa7

Please sign in to comment.