Skip to content

Ensure lists of modules are in alphabetical order #7390

Closed

Description

@jdm

For lists like

mod foo;
pub mod bar;
mod zap;

We should verify that they are sorted alphabetically by module name and report an error if not.

Code: python/tidy.py

Activity

  1. added
    E-less-complex
    on Aug 26, 2015
  2. mylainos commented on Aug 29, 2015

    @mylainos

    I'd like to work on this please. But if something like this happen :

    mod Foo {
    
    }
    mod Bar {
    
    }
    

    we don't report an error because they are not sorted alphabetically, right ?

  3. mylainos commented on Aug 29, 2015

    @mylainos
  4. added
    C-assigned
    on Aug 29, 2015
  5. Ms2ger commented on Aug 29, 2015

    @Ms2ger
    Contributor

    I think it's cleaner in this case to keep it all on one line.

  6. jdm commented on Aug 29, 2015

    @jdm
    MemberAuthor
  7. mylainos commented on Aug 29, 2015

    @mylainos

    The regex at http://mxr.mozilla.org/servo/source/python/tidy.py#195 delete the whole line. This regex line = re.sub('//.*?$|/\*.*?$|^\*.*?$|^#!?\[.*?]\s', '', line) delete just the attribute.
    Now everything work except inline mod. Should I do a PR ?

  8. SimonSapin commented on Aug 29, 2015

    @SimonSapin
    Member

    This might be better as a compiler lint (which uses the existing parser that already knows how to deal with attributes) rather than hack it with string manipulation and regexes.

  9. added
    L-python
    on Aug 30, 2015
  10. mylainos commented on Aug 30, 2015

    @mylainos

    The regex that I changed line = re.sub('//.*?$|/\*.*?$|^\*.*?$|^#!?\[.*?]\s', '', line) only report the attributes with whitespace after (due to the \s). That was for http://mxr.mozilla.org/servo/source/components/style/lib.rs#48.

    But now tidy report that ./components/gfx/font.rs:104: missing space before = http://mxr.mozilla.org/servo/source/components/gfx/font.rs#104.

    And this could conflict with #7460.

  11. added a commit that references this issue on Sep 1, 2015
  12. added a commit that references this issue on Sep 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-machC-assignedE-less-complexL-python

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions