You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 12-running-vscode.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ There are many other features and ways to access them, and we'll cover key ones
58
58
59
59
Extensions are a major strength of VSCode. Whilst VSCode appears quite lightweight, and presents a simple interface (particularly compared to many other IDEs!), this is quite deceptive.
60
60
You can extend its functionality in many different ways.
61
-
For example, installing support for other languages, greater support for version control, there's even support for working with databases, and so on.
61
+
or example, installing support for other languages, greater support for version control, there's even support for working with databases, and so on.
62
62
There are literally tens of thousands of possible extensions now.
63
63
64
64
Now VSCode already comes with built-in support for JavaScript, including TypeScript and node.js,
@@ -67,24 +67,24 @@ Installing a language extension will allow you to do more things with that parti
67
67
68
68
Let's install an extension now:
69
69
70
-
1. Firstly, select the extensions icon, then type in "Python" into the search box at the top, and it'll give you a list of all Python-related extensions.
70
+
1. Firstly, select the extensions icon first, then type in Python into the search box at the top, and it'll give you a list of all python-related extensions.
71
71
1. Select the one which says `Python` from Microsoft. This is the Microsoft official Python extension.
72
72
1. Then select `Install`.
73
73
74
74
It might take a minute - you can see a sliding blue line in the top left to indicate it's working.
75
75
Once complete, you should see a couple of "Welcome" windows introducing you to two of its key features - support for Python and Jupyter notebooks.
76
76
If you use Jupyter notebooks, which is a way of writing Python programs that you can run line by line from within an editor as you write the program, you may find this useful.
77
77
78
-
For now, let's configure this extension for our Python development, and to do that, we need to tell VSCode which Python installation on our machine we'd like it to use. In the Python Welcome window, select `Select a Python interpreter`, and then `Select Python interpreter`.
79
-
You may find you have many installations of Python, or only have one. Try to select the version later than 3.8 if you can.
80
-
Then select `Mark done`, and close the Welcome window.
78
+
For now, let's configure this extension for our Python development, and to do that, we need to do is tell VSCode which Python installation on our machine we'd like it to use. In the Python Welcome window, select `Select a Python interpreter`, and then `Select Python interpreter`.
79
+
You may find you have many installations of Python, or only have one. Try to select one later than 3.8 if you can.
80
+
Then select `Mark done`, and close the welcome windows.
81
81
82
82
## A Sample Project
83
83
84
84
FIXME: copy code-style-example repo to softwaresaved's organisation
85
85
86
86
Next, let's obtain some example Python and edit it from within VSCode.
87
-
First, download the example code we'll use from https://github.com/UNIVERSE-HPC/code-style-example/releases/tag/v1.0.0, either as a `.zip` or `.tar.gz` compressed archive file.
87
+
So first, you can download the example code we'll use from https://github.com/UNIVERSE-HPC/code-style-example/releases/tag/v1.0.0, either as a `.zip` or `.tar.gz` compressed archive file.
88
88
If you're unsure, download the `.zip` file.
89
89
Then, extract all the files from the archive into a convenient location.
90
90
You should see files contained within a new directory named `code-style-example-1.0.0`.
@@ -103,9 +103,9 @@ Note that we're looking for the *folder* that contains the files, not a specific
103
103
104
104
If your system has the Git version control system installed, you may see a `Clone Repository` option here too.
105
105
If you are familiar with Git and wish to use this option instead,
106
-
select it and enter the repository's location as `https://github.com/UNIVERSE-HPC/code-style-example`.
106
+
select this option instead and enter the repository's location as `https://github.com/UNIVERSE-HPC/code-style-example`.
107
107
Then use the file browser that is presented to find a convenient location to store the cloned code and click on `Select as Repository Destination`,
108
-
then select `Open` when ‘Would you like to open the cloned repository?' popup appears.
108
+
then select `Open` when ‘Would you like to open the cloned repository?' appears.
109
109
110
110
:::::::::::::::::::::::::::::::::::::::::
111
111
@@ -126,7 +126,7 @@ So next, let's look at editing code.
126
126
127
127
::::::::::::::::::::::::::::::::::::: keypoints
128
128
129
-
- Key VSCode features are accessible via the left navigation bar and the menu
129
+
- Key VSCode features are accessible via the left navigation bar and the menu.
130
130
- VSCode's capabilities can be increased by installing extensions
131
131
- Language-specific support is available via extensions
132
132
- A VSCode "workspace" is a project that consists of a collection of folder and files
Copy file name to clipboardExpand all lines: 24-linter-advanced.md
+18-6Lines changed: 18 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ exercises: 0
8
8
9
9
- What can I do to increase the detail of Pylint reports?
10
10
- How can I reduce unwanted messages from Pylint?
11
-
- How can I use static code analysis tools with VSCode?
11
+
- How can I use static code analysis tools within VSCode?
12
12
13
13
::::::::::::::::::::::::::::::::::::::::::::::::
14
14
@@ -58,7 +58,13 @@ Messages
58
58
...
59
59
```
60
60
61
-
QUESTION: for those doing activity, who's managed to run this command? YES/NO
61
+
:::::::::::::::::: discussion
62
+
63
+
### Pylint Verbose Reporting - Checkin
64
+
65
+
For those doing activity, who's managed to run this command?
66
+
67
+
::::::::::::::::::
62
68
63
69
It gives you some overall statistics,
64
70
plus comparisons with the last time you ran it,
@@ -72,7 +78,7 @@ on aspects such as:
72
78
73
79
Looking at raw metrics,
74
80
we can see that it breaks down our program into how many lines are
75
-
code lines, python docstrings, standalone comments, and empty lines.
81
+
code lines, Python docstrings, standalone comments, and empty lines.
76
82
This is very useful, since it gives us an idea of how well commented our code is.
77
83
In this case - not very well commented at all!
78
84
For normal comments, the usually accepted wisdom is to add them to explain *why* you are doing something, or perhaps to explain how necessarily complex code works,
@@ -81,7 +87,13 @@ since clearly written code should do that itself.
81
87
82
88
## Increasing our Pylint Score - Adding a Docstring
83
89
84
-
QUESTION: Who's familiar with Python docstrings? Yes/No
90
+
:::::::::::::::::: discussion
91
+
92
+
### Docstrings - Checkin
93
+
94
+
Who's familiar with Python docstrings?
95
+
96
+
::::::::::::::::::
85
97
86
98
Docstrings are a special kind of comment for a function,
87
99
that explain what the function does,
@@ -99,7 +111,7 @@ Let's add one to our code now, within the `fahr_to_celsius` function.
99
111
"""
100
112
```
101
113
102
-
Re-run pylint - can see we have one less docstring error, and a slightly higher score.
114
+
Re-run `pylint` command - can see we have one less docstring error, and a slightly higher score.
103
115
104
116
If you'd like to know more about docstrings and commenting,
105
117
there's an in-depth [RealPython tutorial](https://realpython.com/documenting-python-code/) on these and the different ways you can format them.
@@ -191,7 +203,7 @@ Every time you re-run it now, the `C0301` issue will not be present.
191
203
## Using Pylint within VSCode
192
204
193
205
The good news is that if you're using the VSCode IDE,
194
-
we can also (or alternatively) install a Python linter in VSCode to give us this code analysis functionality, by installing a pylint extension.
206
+
we can also (or alternatively) install a Python linter in VSCode to give us this code analysis functionality, by installing the Pylint extension.
195
207
Select the `Extensions` icon and this time search for `Pylint`, the one by Microsoft, and click `Install`.
196
208
197
209
Going back to our code you should now find lots of squiggly underlines of various colours.
0 commit comments