Skip to content

Commit

Permalink
Use develop for comparing lint rules (#3079)
Browse files Browse the repository at this point in the history
* Use develop for comparing lint rules

* Try to fetch develop branch

* Use origin/develop instead of develop

* Fetch origin

* Use develop instead of origin/develop after fetching origin

* git branch develop

* fetch origin

* Show available branches

* Pull from origin

* Try fetch instead of pull

* Save checked out branch before fetch

* Don't use Object type
  • Loading branch information
pablopunk authored Sep 4, 2019
1 parent b0e67d7 commit 8a48943
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ cache:
- $HOME/.cache/yarn

script:
- git checkout -b travis-save-branch
- git fetch origin develop:develop
- npm run test
- npm run lint
- npm run build
18 changes: 9 additions & 9 deletions grep-lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def get_command(branch=None):

if branch is not None:
arguments_list.append(branch)

arguments_list.append("--")
arguments_list.append("scripts")

Expand Down Expand Up @@ -56,20 +56,20 @@ def get_command(branch=None):
rule_regex = rule['perl_regex']
rule_name = rule['name']

# will not error if the amount of violations is less than on master
# will not error if the amount of violations is less than on develop
rule_tolerance = rule['tolerance']

try:
violations_count_master = len(
subprocess.check_output(get_command("master")).decode('utf-8').splitlines()
violations_count_develop = len(
subprocess.check_output(get_command("develop")).decode('utf-8').splitlines()
)
except subprocess.CalledProcessError as e:
# ignore exception if grep simply didn't find matches
if len(e.output) != 0:
raise e
else:
violations_count_master = 0
violations_count_develop = 0


try:
violations = subprocess.check_output(get_command(), stderr=subprocess.STDOUT).decode('utf-8')
Expand All @@ -82,13 +82,13 @@ def get_command(branch=None):

violations_count = len(violations.splitlines())

if (violations_count > 0 and rule_tolerance is False) or violations_count > violations_count_master:
if (violations_count > 0 and rule_tolerance is False) or violations_count > violations_count_develop:
any_rule_violated = True
print('\n\n' + violations + '\n\n')
print("GREP-LINT RULE VIOLATED! '" + rule_name + "'")
print("Rule regex: `" + rule_regex + "`")

if rule_tolerance is True:
print('Tolerance is enabled, but ' + str(violations_count) + ' violations were found in the working while there only are ' + str(violations_count_master) + ' violations on master. See grep-lint.py for details.')
print('Tolerance is enabled, but ' + str(violations_count) + ' violations were found in the working while there only are ' + str(violations_count_develop) + ' violations on develop. See grep-lint.py for details.')

sys.exit(1 if any_rule_violated else 0)
sys.exit(1 if any_rule_violated else 0)
2 changes: 1 addition & 1 deletion scripts/core/editor3/components/Editor3Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export class Editor3Component extends React.Component<IProps> {
return !canDropMedia(e, this.props);
}

handleDropOnEditor(selection: SelectionState, dataTransfer: Object, isInternal: DraftDragType): DraftHandleValue {
handleDropOnEditor(selection: SelectionState, dataTransfer: any, isInternal: DraftDragType): DraftHandleValue {
if (isInternal) {
const {editorState} = this.props;
const targetBlockKey = selection.getStartKey();
Expand Down

0 comments on commit 8a48943

Please sign in to comment.