(self)
| 248 | self.results["hide_skipped"] = hide_skipped |
| 249 | |
| 250 | def report(self) -> Results: |
| 251 | self.results["title"] = self.ids.info.get("title", "Untitled IDS") |
| 252 | self.results["date"] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") |
| 253 | self.results["filepath"] = self.ids.filepath |
| 254 | self.results["filename"] = self.ids.filename |
| 255 | total_specifications = 0 |
| 256 | total_specifications_pass = 0 |
| 257 | total_requirements = 0 |
| 258 | total_requirements_pass = 0 |
| 259 | total_checks = 0 |
| 260 | total_checks_pass = 0 |
| 261 | status = True |
| 262 | self.results["specifications"] = [] |
| 263 | for specification in self.ids.specifications: |
| 264 | specification_report = self.report_specification(specification) |
| 265 | self.results["specifications"].append(specification_report) |
| 266 | total_specifications += 1 |
| 267 | total_specifications_pass += 1 if specification_report["status"] else 0 |
| 268 | total_requirements += len(specification_report["requirements"]) |
| 269 | total_requirements_pass += len([r for r in specification_report["requirements"] if r["status"]]) |
| 270 | total_checks += specification_report["total_checks"] |
| 271 | total_checks_pass += specification_report["total_checks_pass"] |
| 272 | if not specification_report["status"]: |
| 273 | status = False |
| 274 | self.results["status"] = status |
| 275 | self.results["total_specifications"] = total_specifications |
| 276 | self.results["total_specifications_pass"] = total_specifications_pass |
| 277 | self.results["total_specifications_fail"] = total_specifications - total_specifications_pass |
| 278 | self.results["percent_specifications_pass"] = ( |
| 279 | math.floor((total_specifications_pass / total_specifications) * 100) if total_specifications else "N/A" |
| 280 | ) |
| 281 | self.results["total_requirements"] = total_requirements |
| 282 | self.results["total_requirements_pass"] = total_requirements_pass |
| 283 | self.results["total_requirements_fail"] = total_requirements - total_requirements_pass |
| 284 | self.results["percent_requirements_pass"] = ( |
| 285 | math.floor((total_requirements_pass / total_requirements) * 100) if total_requirements else "N/A" |
| 286 | ) |
| 287 | self.results["total_checks"] = total_checks |
| 288 | self.results["total_checks_pass"] = total_checks_pass |
| 289 | self.results["total_checks_fail"] = total_checks - total_checks_pass |
| 290 | self.results["percent_checks_pass"] = ( |
| 291 | math.floor((total_checks_pass / total_checks) * 100) if total_checks else "N/A" |
| 292 | ) |
| 293 | return self.results |
| 294 | |
| 295 | def report_specification(self, specification: Specification) -> ResultsSpecification: |
| 296 | applicability = [a.to_string("applicability") for a in specification.applicability] |
no test coverage detected