Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing changes to assess Swimm functionality #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .swm/adding-and-updating-cli-commands.ab20ptib.sw.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def users(num): # pragma: no cover

</SwmSnippet>

<SwmSnippet path="/api/fake.py" line="36">
<SwmSnippet path="/api/fake.py" line="38">

---

Expand Down Expand Up @@ -97,11 +97,11 @@ I am unable to embed a smart token into a code block to link the snippet to unde

I am able to replicate the revision functionality below however it is more time consuming and less visually indicative of a copyable CLI command wrapped in a code block:

`flask fake `<SwmToken path="/api/fake.py" pos="14:2:2" line-data="def users(num): # pragma: no cover">`users`</SwmToken>` <`<SwmToken path="/api/fake.py" pos="36:6:6" line-data="@click.argument(&#39;num&#39;, type=int)">`num`</SwmToken>`>`
`flask fake `<SwmToken path="/api/fake.py" pos="14:2:2" line-data="def users(num): # pragma: no cover">`users`</SwmToken>` <`<SwmToken path="/api/fake.py" pos="38:6:6" line-data="@click.argument(&#39;num&#39;, type=int)">`num`</SwmToken>`>`

`flask fake `<SwmToken path="/api/fake.py" pos="37:2:2" line-data="def posts(num): # pragma: no cover">`posts`</SwmToken>` <`<SwmToken path="/api/fake.py" pos="36:6:6" line-data="@click.argument(&#39;num&#39;, type=int)">`num`</SwmToken>`>`
`flask fake `<SwmToken path="/api/fake.py" pos="39:2:2" line-data="def posts(num): # pragma: no cover">`posts`</SwmToken>` <`<SwmToken path="/api/fake.py" pos="38:6:6" line-data="@click.argument(&#39;num&#39;, type=int)">`num`</SwmToken>`>`

It's important to know that the smart tokens will only alert when the names they are referring to change. This means that if the <SwmToken path="/api/fake.py" pos="14:2:2" line-data="def users(num): # pragma: no cover">`users`</SwmToken> function name changes or the <SwmToken path="/api/fake.py" pos="36:6:6" line-data="@click.argument(&#39;num&#39;, type=int)">`num`</SwmToken> parameter where to change the CI will flag, however if the logic of the function changes then no alert will flag. This should not be a major issue assuming we don't regularly leave the name of a function the same while radically changing the underlying logic (rather than refactoring).
It's important to know that the smart tokens will only alert when the names they are referring to change. This means that if the <SwmToken path="/api/fake.py" pos="14:2:2" line-data="def users(num): # pragma: no cover">`users`</SwmToken> function name changes or the <SwmToken path="/api/fake.py" pos="38:6:6" line-data="@click.argument(&#39;num&#39;, type=int)">`num`</SwmToken> parameter where to change the CI will flag, however if the logic of the function changes then no alert will flag. This should not be a major issue assuming we don't regularly leave the name of a function the same while radically changing the underlying logic (rather than refactoring).

&nbsp;

Expand Down
5 changes: 4 additions & 1 deletion api/fake.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@

@fake.cli.command()
@click.argument('num', type=int)
def users(num): # pragma: no cover
# Breaking Change
def userss(num): # pragma: no cover
"""Create the given number of fake users."""
users = []
for i in range(num):
print("Not a Breaking Change")
user = User(username=faker.user_name(), email=faker.email(),
about_me=faker.sentence())
db.session.add(user)
users.append(user)

# create some followers as well
for user in users:
print("Doc Breaking Change")
num_followers = random.randint(0, 5)
for i in range(num_followers):
following = random.choice(users)
Expand Down