webcode-tk 1.0.1__tar.gz → 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: webcode-tk
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary:
5
5
  Home-page: https://github.com/HundredVisionsGuy/webcode-tk
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "webcode-tk"
3
- version = "1.0.1"
3
+ version = "1.0.2"
4
4
  description = ""
5
5
  authors = ["hundredvisionsguy <cwinikka@gmail.com>"]
6
6
  keywords = ["html", "validation", "css", ]
@@ -18,4 +18,4 @@ Modules exported by this package:
18
18
  - `validator_tools`: sends HTML or CSS code to the W3C Validator to check
19
19
  for errors.
20
20
  """
21
- __version__ = "1.0.1"
21
+ __version__ = "1.0.2"
@@ -1493,7 +1493,7 @@ def update_contrast_results(
1493
1493
 
1494
1494
 
1495
1495
  def get_color_contrast_details(tree: CSSAppliedTree, rating="AAA") -> list:
1496
- """returns a list of all all failures or a pass based on rating
1496
+ """returns a list of all failures or a pass based on rating
1497
1497
 
1498
1498
  We'll create a recursive inner nested function to traverse the DOM. We will
1499
1499
  target only the styles that are applied directly so as to not overwhelm the
@@ -1567,7 +1567,12 @@ def get_color_contrast_details(tree: CSSAppliedTree, rating="AAA") -> list:
1567
1567
 
1568
1568
  for element in elements:
1569
1569
  check_element(element, rating, filename)
1570
- if not results:
1570
+ if results:
1571
+ adjusted = []
1572
+ for result in results:
1573
+ adjusted.append("fail: " + result)
1574
+ results = adjusted
1575
+ else:
1571
1576
  # It's a success! Let's let them know
1572
1577
  msg = f"success: {filename} passes color contrast for {rating} Normal"
1573
1578
  msg += " and Large."
@@ -262,6 +262,7 @@ def get_project_validation(project_dir: str, type="html") -> list:
262
262
  will return a list of per-files errors
263
263
  """
264
264
  report = []
265
+ passing_files = []
265
266
  all_files = clerk.get_all_project_files(project_dir)
266
267
  for file in all_files:
267
268
  errors = []
@@ -274,24 +275,37 @@ def get_project_validation(project_dir: str, type="html") -> list:
274
275
  f"fail: {filename} has {len(errors)} validation errors."
275
276
  )
276
277
  else:
277
- report.append(f"pass: {filename} passes HTML validation!")
278
+ passing_files.append(filename)
278
279
  else:
279
- if file_type == "html":
280
+ if file_type == "html" and type == "css":
280
281
  style_tag = html.get_elements("style", file)
281
282
  if style_tag:
282
283
  code = html.get_element_content(style_tag)
283
284
  result = validate_css(code)
284
- errors += get_css_errors_list(result)
285
+ errors_list = get_css_errors_list(result)
286
+ if errors_list:
287
+ errors += errors_list
288
+ else:
289
+ passing_files.append(filename)
285
290
  if file_type == "css":
286
291
  code = clerk.file_to_string(file)
287
292
  result = validate_css(code)
288
- errors += get_css_errors_list(result)
293
+ errors_list = get_css_errors_list(result)
294
+ if errors_list:
295
+ errors += errors_list
296
+ else:
297
+ passing_files.append(filename)
289
298
  if errors:
290
299
  report.append(
291
300
  f"fail: {filename} has {len(errors)} css errors."
292
301
  )
293
302
  if not report:
294
- report.append("fail: no files present to validate")
303
+ if passing_files:
304
+ for passing_file in passing_files:
305
+ msg = f"pass: {passing_file} passes {type.upper()} validation"
306
+ report.append(msg)
307
+ if not passing_files:
308
+ report.append("fail: no files present to validate")
295
309
  # TODO - make sure this covers all scenarios
296
310
  return report
297
311
 
File without changes
File without changes