Skip to content
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

DocStyleBear: Raw docstrings having r added in generated patch. #2010

Open
co-robo opened this issue Aug 21, 2017 · 14 comments
Open

DocStyleBear: Raw docstrings having r added in generated patch. #2010

co-robo opened this issue Aug 21, 2017 · 14 comments

Comments

@co-robo
Copy link

co-robo commented Aug 21, 2017

For reference
https://gist.github.com/damngamerz/7382ac7b5d5504e6508cf30decfbe9d7#file-test_docstylebear_coala-txt-L204
Probable solution will be
indent = ' ' * len(# whatever behind starting marker)
Opened by @damngamerz at gitter//damngamerz

@ishanSrt
Copy link

ishanSrt commented Jan 21, 2018

You mean lines like 210 and 215 @damngamerz
I can't find a DocStyleBear, all I see is PyDocStyleBear

@kriti21
Copy link
Contributor

kriti21 commented Feb 7, 2018

@ishanSrt
Copy link

ishanSrt commented Feb 7, 2018

Yes most probably

@kriti21
Copy link
Contributor

kriti21 commented Feb 7, 2018

Please assign this issue to me.

@kriti21
Copy link
Contributor

kriti21 commented Feb 8, 2018

This issue is not due to any fault in the DocumentationStyleBear. The file to be corrected is https://github.com/coala/coala/blob/master/coalib/results/AbsolutePosition.py . There is an extra "r" in the beginning of the docstring which needs to be removed. Refer https://github.com/coala/coala/blob/1d9eb29c179359bdccb050e39fec14aed2ec2073/coalib/results/AbsolutePosition.py#L32

@kriti21
Copy link
Contributor

kriti21 commented Feb 8, 2018

Since it is a part of main coala repository, I think this issue can be closed here and opened in coala repository with correct description. This would be a good issue for any newcomer. Can I do that @Makman2 @ishanSrt @damngamerz

@ishanSrt
Copy link

ishanSrt commented Feb 8, 2018

@kriti21 I don't think you understand the concept of raw strings in python. Check them out! This is a valid bug (although I didn't test it myself) if the gist produced by damngamerz is the output of DocumentationStyleBear. This issue seems to be in the correct repository too. The only thing that could be corrected is @Makman2 can you change the title DocStyleBear-->DocumentationStyleBear and that's it!

@kriti21
Copy link
Contributor

kriti21 commented Feb 8, 2018

@ishanSrt I read about raw strings in python. Sorry for the misunderstanding. However, I am not able to generate this bug myself. I did run DocumentationStyleBear on some file but any such output did not appear. Please help.

@ishanSrt
Copy link

ishanSrt commented Feb 8, 2018

@kriti21 will get back to you on this as soon as I get time 👍

@kriti21
Copy link
Contributor

kriti21 commented Feb 8, 2018

Alright

@kriti21
Copy link
Contributor

kriti21 commented Feb 12, 2018

@ishanSrt you got some time to help me in generating this issue locally ?

@ishanSrt
Copy link

@kriti21 sorry for the delay 😅. The issue can be replicated exactly as mentioned in the gist. Just tried it out myself with DocumentationStyleBear. Just take a file which already has a raw docstring and you'll be good to go!

@ishanSrt
Copy link

Here is the file AbsolutePosition.py after DocumentationStyleBear ran on it:

from coalib.results.TextPosition import TextPosition
from coala_utils.decorators import enforce_signature


class AbsolutePosition(TextPosition):

    @enforce_signature
    def __init__(self,
                 text: (tuple, list, None)=None,
                 position: (int, None)=None):
        """
        Creates an AbsolutePosition object that represents the index of a
        character in a string.

        :param text:
            The text containing the character.
        :param position:
            Position identifying the index of character
            in text.
        """
        line = column = None
        if position is not None and text is not None:
            line, column = calc_line_col(text, position)
        self._text = text
        self._position = position
        super().__init__(line, column)

    @property
    def position(self):
        return self._position


def calc_line_col(text, position):
    r"""
    rCreates a tuple containing (line, column) by calculating line number
    rand column in the text, from position.

    rThe position represents the index of a character. In the following
    rexample 'a' is at position '0' and it's corresponding line and column are:

    r>>> calc_line_col(('a\n',), 0)
    r(1, 1)

    rAll special characters(including the newline character) belong in the same
    rline, and have their own position. A line is an item in the tuple:

    r>>> calc_line_col(('a\n', 'b\n'), 1)
    r(1, 2)
    r>>> calc_line_col(('a\n', 'b\n'), 2)
    r(2, 1)

    r:param text:
    r    A tuple/list of lines in which position is to
    r    be calculated.
    r:param position:
    r    Position (starting from 0) of character to be found
    r    in the (line, column) form.
    r:return:
    r    A tuple of the form (line, column), where both line
    r    and column start from 1.
    r"""
    for linenum, line in enumerate(text, start=1):
        linelen = len(line)
        if position < linelen:
            return linenum, position + 1
        position -= linelen

    raise ValueError('Position not found in text')

@kriti21
Copy link
Contributor

kriti21 commented Feb 12, 2018

Thanks for the help @ishanSrt

kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 16, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 16, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 16, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala that referenced this issue Feb 18, 2018
This adds new markers to support
raw doctrings in python documentation.

Fixes coala/coala-bears#2010
kriti21 added a commit to kriti21/coala that referenced this issue Feb 18, 2018
This adds new markers to support
raw doctrings in python documentation.

Fixes coala/coala-bears#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 18, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala that referenced this issue Feb 19, 2018
This adds new markers to support
raw doctrings in python documentation.

Fixes coala/coala-bears#2010
kriti21 added a commit to kriti21/coala that referenced this issue Feb 19, 2018
This adds new markers to support
raw doctrings in python documentation.

Fixes coala/coala-bears#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 19, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 19, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 19, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 19, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 19, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 19, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 19, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 19, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 20, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 20, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 20, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 20, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 20, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 20, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 25, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 25, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Feb 25, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Mar 4, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Mar 4, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Mar 4, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Mar 4, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Mar 4, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Mar 4, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Mar 4, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Mar 5, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Mar 5, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala-bears that referenced this issue Mar 5, 2018
This removes the extra 'r' added in raw docstrings
in generated patch in python by DocumentationStyleBear.

Fixes coala#2010
kriti21 added a commit to kriti21/coala that referenced this issue Apr 14, 2018
This adds new markers to support
raw doctrings in python documentation.

Fixes coala/coala-bears#2010
kriti21 added a commit to kriti21/coala that referenced this issue Apr 14, 2018
This adds new markers to support
raw doctrings in python documentation.

Fixes coala/coala-bears#2010
kriti21 added a commit to kriti21/coala that referenced this issue Apr 17, 2018
This adds new markers to support
raw doctrings in python documentation.

Fixes coala/coala-bears#2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants