Skip to content

Commit 9cf4562

Browse files
joke1196guillaume-dequenne
authored andcommitted
SONARPY-1378 Rule S5549: Import emoji library for up-to-date stubs generation
1 parent 975153a commit 9cf4562

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

python-checks/src/test/resources/checks/argumentType.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def builtin_functions():
107107

108108
def third_party_functions():
109109
emojize("Python is :thumbs_up:") # OK
110-
emojize(42) # FN Noncompliant
110+
emojize(42) # Noncompliant
111111

112112
def type_aliases():
113113
def with_set(a : Set[int]): ...

python-checks/src/test/resources/checks/duplicateArgument.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ def rectangle((top, left), (width, height)): ...
8282

8383
def function_from_typeshed():
8484
import emoji
85-
emoji.emojize(":rocket:", True, use_aliases=True) # FN Noncompliant {{Remove duplicate values for parameter "use_aliases" in "emojize" call.}}
86-
## ^^^^ ^^^^^^^^^^^^^^^^<
85+
emoji.emojize(":rocket:", (":", ":"), delimiters=(":", ":")) # Noncompliant {{Remove duplicate values for parameter "delimiters" in "emojize" call.}}
86+
# ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^<
8787

8888
def self_ignored():
8989
class MyClass:

python-checks/src/test/resources/checks/sillyEquality.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ def stdlib():
7070
if platform.architecture() == '32bit': ... # Noncompliant
7171

7272
def third_party():
73-
if emojize("Python is :thumbs_up:") == 42: ... # FN Noncompliant
73+
if emojize("Python is :thumbs_up:") == 42: ... # Noncompliant

python-frontend/typeshed_serializer/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ characteristic==14.3.0
1515
click==8.1.3
1616
cryptography==36.0.1
1717
dataclasses==0.6
18+
emoji==2.1.0
19+
types-emoji==2.1.0.3
1820
enum34==1.1.10
1921
filelock==3.4.0
2022
first==2.0.2

python-frontend/typeshed_serializer/resources/importer/sonar_third_party_libs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import contextvar
2828
import cryptography
2929
import dataclasses
30+
import emoji
3031
import enum34
3132
import fb303
3233
import filelock

0 commit comments

Comments
 (0)