2323
2424LOCAL_DEPS = (os .path .join (".." , "api_core" ), os .path .join (".." , "core" ))
2525
26+ BLACK_PATHS = ["docs" , "google" , "tests" , "noxfile.py" , "setup.py" ]
27+
28+ if os .path .exists ("samples" ):
29+ BLACK_PATHS .append ("samples" )
30+
31+
2632@nox .session (python = "3.7" )
2733def lint (session ):
2834 """Run linters.
@@ -31,13 +37,7 @@ def lint(session):
3137 serious code quality issues.
3238 """
3339 session .install ("flake8" , "black" , * LOCAL_DEPS )
34- session .run (
35- "black" ,
36- "--check" ,
37- "google" ,
38- "tests" ,
39- "docs" ,
40- )
40+ session .run ("black" , "--check" , * BLACK_PATHS )
4141 session .run ("flake8" , "google" , "tests" )
4242
4343
@@ -52,12 +52,7 @@ def blacken(session):
5252 check the state of the `gcp_ubuntu_config` we use for that Kokoro run.
5353 """
5454 session .install ("black" )
55- session .run (
56- "black" ,
57- "google" ,
58- "tests" ,
59- "docs" ,
60- )
55+ session .run ("black" , * BLACK_PATHS )
6156
6257
6358@nox .session (python = "3.7" )
@@ -140,21 +135,24 @@ def cover(session):
140135
141136 session .run ("coverage" , "erase" )
142137
138+
143139@nox .session (python = "3.7" )
144140def docs (session ):
145141 """Build the docs for this library."""
146142
147- session .install ('-e' , '.' )
148- session .install (' sphinx' , ' alabaster' , ' recommonmark' )
143+ session .install ("-e" , "." )
144+ session .install (" sphinx" , " alabaster" , " recommonmark" )
149145
150- shutil .rmtree (os .path .join (' docs' , ' _build' ), ignore_errors = True )
146+ shutil .rmtree (os .path .join (" docs" , " _build" ), ignore_errors = True )
151147 session .run (
152- 'sphinx-build' ,
153- '-W' , # warnings as errors
154- '-T' , # show full traceback on exception
155- '-N' , # no colors
156- '-b' , 'html' ,
157- '-d' , os .path .join ('docs' , '_build' , 'doctrees' , '' ),
158- os .path .join ('docs' , '' ),
159- os .path .join ('docs' , '_build' , 'html' , '' ),
148+ "sphinx-build" ,
149+ "-W" , # warnings as errors
150+ "-T" , # show full traceback on exception
151+ "-N" , # no colors
152+ "-b" ,
153+ "html" ,
154+ "-d" ,
155+ os .path .join ("docs" , "_build" , "doctrees" , "" ),
156+ os .path .join ("docs" , "" ),
157+ os .path .join ("docs" , "_build" , "html" , "" ),
160158 )
0 commit comments