7,743 questions
-3
votes
1
answer
78
views
Usage of tap({ error }) vs. catchError for side effects [closed]
In Angular/RxJS, when should you use tap({ error }) and when catchError for side effects? How do you best separate the two logically or combine them?
For example, does resetting the UI to its previous ...
2
votes
0
answers
49
views
Unable to structure the codebase folders
I am very confused regarding the structure of codebase . I want to build an application which has frontend as well as backend part . Now the question is how can i write the code like ? in a single ...
0
votes
0
answers
33
views
Can't enable code editing in WebStorm with Vue cli
I'm new in Vue, and I'm trying to enable code style inside a <script> block in WebStorm, and in the settings everything is correct, but the style still doesn't work inside the <script> tag....
-6
votes
1
answer
152
views
Is it acceptable practice to alias nested templates like std::vector<std::vector<T>> for readability in a team environment? [closed]
I'm aware that C++11 introduced alias templates (which is well-explained in this thread) that makes it simple to reduce verbosity. For example:
#include <vector>
template <typename T>
...
2
votes
0
answers
56
views
ESLint rule to enforce newline indentation style for multi-line assignments/expressions?
I'm trying to enforce this indentation style in TypeScript:
const response: Asana.Response<Asana.Tag[]> =
await tagsApi.getTagsForWorkspace(process.env.ASANA_WORKSPACE_GID!, opts);
...
1
vote
0
answers
26
views
How to disallow newlines before or after comments with ESLint?
The @stylistic/lines-around-comment rule allows me to require new lines before or after comments, but I can't seem to find a way to disallow them. I thought the @stylistic/padding-line-between-...
2
votes
2
answers
166
views
how to change code style format on flutter
I am developing with Flutter using Android Studio. When I try to format the code using the Cmd + Opt + L keys, it ends up like #1 below.
Is there a good way to make it look like #2?
//#1
@override
...
-1
votes
1
answer
48
views
Indentation Rule in SonarLint for Typescript
I am new to sonarLint rules, I am trying to findout the rule for indentation and variable naming in typescript rules.But couldn't find it.
I was able to find naming rules for classes and functions but ...
0
votes
1
answer
120
views
Wrap long C++ function heads with clang-format
I just started to use clang-format and I could set up quite a lot of things, but I am stuck with my general handling of long function headers. This is how I usually create them:
void ...
4
votes
2
answers
187
views
How to make all our code comply to coding conventions/coding styles?
I'm trying to set up SonarQube to have our coding conventions/rules in it. I'm looking for ideas on how to do this best. We're using C# as our dev language and Visual Studio as our IDE.
We have dozens ...
0
votes
1
answer
217
views
Switch case: Return from impossible default case
What to do if I use a switch case in a function, and the default case should not happen, yet I must return something?
I tried to program some cellular automaton, where there are two possible cell ...
0
votes
2
answers
96
views
Avoid ifdef in my project for multiple hardware
I have a project written in C on STM32 platform. My project source code will be available for multiple hardware. I use CMakeLists
For example I have 2 header for the moment hardware1.h and hardware2....
-6
votes
3
answers
74
views
Scope Variable inside Python's Try, Except block
At first, i wrote my simple code as below:
while True:
try:
x = int(input("what's x? "))
except ValueError:
print(f"x is not an integer!")
else:
...
0
votes
1
answer
51
views
How to manage multiple uses of a model in an application?
I'm currently implementing an application and have for example a Customer model that's used in several different parts of the application. Each part only uses a subset of the properties from the ...
-1
votes
1
answer
137
views
I want to add retry logic and. refactor the code in the python socket connect code
I have the below Python code which checks whether the ssh host is up or not:
`for hostname ,ipaddr in host_dict.items():
if tcp_conn.tcp_port_is_open(ipaddr, constants.TCP_PORT, ...