• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/utils/checkpackagelib/lib_config.py
Thomas PetazzoniThomas Petazzoni committed 7ca9fc3170d01 Jul 2017
Raw file
Source viewDiff to previous
 
1
# See utils/checkpackagelib/readme.txt before editing this file.
2
# Kconfig generates errors if someone introduces a typo like "boool" instead of
3
# "bool", so below check functions don't need to check for things already
4
# checked by running "make menuconfig".
5
​
6
import re
7
​
8
from base import _CheckFunction
9
# Notice: ignore 'imported but unused' from pyflakes for check functions.
10
from lib import ConsecutiveEmptyLines
11
from lib import EmptyLastLine
12
from lib import NewlineAtEof
13
from lib import TrailingSpace
14
​
15
​
16
def _empty_or_comment(text):
17
    line = text.strip()
18
    # ignore empty lines and comment lines indented or not
19
    return line == "" or line.startswith("#")
20
​
21
​
22
def _part_of_help_text(text):
23
    return text.startswith("\t  ")
24
​
25
​
26
# used in more than one check
27
entries_that_should_not_be_indented = [
28
    "choice", "comment", "config", "endchoice", "endif", "endmenu", "if",
29
    "menu", "menuconfig", "source"]
30
​
31
​
32
class AttributesOrder(_CheckFunction):
33
    attributes_order_convention = {
34
        "bool": 1, "prompt": 1, "string": 1, "default": 2, "depends": 3,
35
        "select": 4, "help": 5}
36
​
37
    def before(self):
38
        self.state = 0
39
​
40
    def check_line(self, lineno, text):
41
        if _empty_or_comment(text) or _part_of_help_text(text):
42
            return
43
​
44
        attribute = text.split()[0]
45
​
46
        if attribute in entries_that_should_not_be_indented:
47
            self.state = 0
48
            return
49
        if attribute not in self.attributes_order_convention.keys():
50
            return
51
        new_state = self.attributes_order_convention[attribute]
52
        wrong_order = self.state > new_state
53
​
54
        # save to process next line
55
        self.state = new_state
56
​
57
        if wrong_order:
58
            return ["{}:{}: attributes order: type, default, depends on,"
59
                    " select, help ({}#_config_files)"
60
                    .format(self.filename, lineno, self.url_to_manual),
61
                    text]
62
​
63
​
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.