Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
bf06eafb
Commit
bf06eafb
authored
Jan 27, 2016
by
Philipp Wolfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AngularJS check: Removed caching
This was removed from all checks in
a0009086
parent
821d3b39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
24 deletions
+13
-24
weblate/trans/checks/angularjs.py
weblate/trans/checks/angularjs.py
+5
-8
weblate/trans/tests/test_angularjs_checks.py
weblate/trans/tests/test_angularjs_checks.py
+8
-16
No files found.
weblate/trans/checks/angularjs.py
View file @
bf06eafb
...
...
@@ -47,23 +47,20 @@ class AngularJSInterpolationCheck(TargetCheck):
default_disabled = True
severity = '
danger
'
def check_single(self, source, target, unit
, cache_slot
):
def check_single(self, source, target, unit):
# Verify unit is properly flagged
if self.enable_string not in unit.all_flags:
return False
# Try geting source parsing from cache
src_match = self.get_cache(unit, cache_slot)
src_match = ANGULARJS_INTERPOLATION_MATCH.findall(source)
# Cache miss
if src_match is None:
src_match = ANGULARJS_INTERPOLATION_MATCH.findall(source)
self.set_cache(unit, src_match, cache_slot)
# Any interpolation strings in source?
if len(src_match) == 0:
return False
# Parse target
tgt_match = ANGULARJS_INTERPOLATION_MATCH.findall(target)
# Fail the check if the number of matches is different
if len(src_match) != len(tgt_match):
return True
...
...
weblate/trans/tests/test_angularjs_checks.py
View file @
bf06eafb
...
...
@@ -36,50 +36,42 @@ class AngularJSInterpolationCheckTest(TestCase):
self
.
assertFalse
(
self
.
check
.
check_single
(
'strins'
,
'string'
,
MockUnit
(
'angularjs_no_format'
,
flags
=
'angularjs-format'
),
0
MockUnit
(
'angularjs_no_format'
,
flags
=
'angularjs-format'
)
))
def
test_format
(
self
):
self
.
assertFalse
(
self
.
check
.
check_single
(
u'{{name}} string {{other}}'
,
u'{{name}} {{other}} string'
,
MockUnit
(
'angularjs_format'
,
flags
=
'angularjs-format'
),
0
MockUnit
(
'angularjs_format'
,
flags
=
'angularjs-format'
)
))
def
test_format_ignore_position
(
self
):
self
.
assertFalse
(
self
.
check
.
check_single
(
u'{{name}} string {{other}}'
,
u'{{other}} string {{name}}'
,
MockUnit
(
'angularjs_format_ignore_position'
,
flags
=
'angularjs-format'
),
0
MockUnit
(
'angularjs_format_ignore_position'
,
flags
=
'angularjs-format'
)
))
def
test_different_whitespace
(
self
):
self
.
assertFalse
(
self
.
check
.
check_single
(
u'{{ name }} string'
,
u'{{name}} string'
,
MockUnit
(
'angularjs_different_whitespace'
,
flags
=
'angularjs-format'
),
0
MockUnit
(
'angularjs_different_whitespace'
,
flags
=
'angularjs-format'
)
))
def
test_missing_format
(
self
):
self
.
assertTrue
(
self
.
check
.
check_single
(
u'{{name}} string'
,
u'string'
,
MockUnit
(
'angularjs_missing_format'
,
flags
=
'angularjs-format'
),
0
MockUnit
(
'angularjs_missing_format'
,
flags
=
'angularjs-format'
)
))
def
test_wrong_value
(
self
):
self
.
assertTrue
(
self
.
check
.
check_single
(
u'{{name}} string'
,
u'{{nameerror}} string'
,
MockUnit
(
'angularjs_wrong_value'
,
flags
=
'angularjs-format'
),
0
MockUnit
(
'angularjs_wrong_value'
,
flags
=
'angularjs-format'
)
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment