Title: [RulePad] Incorrect violations are produced for a design rule. · Issue #28 · ourcodeinc/ActiveDocumentation-webapp · GitHub
Open Graph Title: [RulePad] Incorrect violations are produced for a design rule. · Issue #28 · ourcodeinc/ActiveDocumentation-webapp
X Title: [RulePad] Incorrect violations are produced for a design rule. · Issue #28 · ourcodeinc/ActiveDocumentation-webapp
Description: RulePad: Code: package io.hexlet.typoreporter.controller; import io.hexlet.typoreporter.domain.typo.TypoEvent; import io.hexlet.typoreporter.service.TypoService; import io.hexlet.typoreporter.service.WorkspaceService; import io.hexlet.ty...
Open Graph Description: RulePad: Code: package io.hexlet.typoreporter.controller; import io.hexlet.typoreporter.domain.typo.TypoEvent; import io.hexlet.typoreporter.service.TypoService; import io.hexlet.typoreporter.servi...
X Description: RulePad: Code: package io.hexlet.typoreporter.controller; import io.hexlet.typoreporter.domain.typo.TypoEvent; import io.hexlet.typoreporter.service.TypoService; import io.hexlet.typoreporter.servi...
Opengraph URL: https://github.com/ourcodeinc/ActiveDocumentation-webapp/issues/28
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[RulePad] Incorrect violations are produced for a design rule.","articleBody":"- RulePad:\r\n\r\n\r\n\r\n- Code:\r\n```Java\r\npackage io.hexlet.typoreporter.controller;\r\n\r\nimport io.hexlet.typoreporter.domain.typo.TypoEvent;\r\nimport io.hexlet.typoreporter.service.TypoService;\r\nimport io.hexlet.typoreporter.service.WorkspaceService;\r\nimport io.hexlet.typoreporter.handler.exception.TypoNotFoundException;\r\nimport io.hexlet.typoreporter.handler.exception.WorkspaceNotFoundException;\r\nimport lombok.RequiredArgsConstructor;\r\nimport lombok.extern.slf4j.Slf4j;\r\nimport org.springframework.stereotype.Controller;\r\nimport org.springframework.web.bind.annotation.PatchMapping;\r\nimport org.springframework.web.bind.annotation.PathVariable;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RequestParam;\r\n\r\nimport java.util.Optional;\r\n\r\n//TODO add tests\r\n@Slf4j\r\n@Controller\r\n@RequestMapping(\"/typos\")\r\n@RequiredArgsConstructor\r\npublic class TypoController {\r\n\r\n private final TypoService typoService;\r\n\r\n private final WorkspaceService workspaceService;\r\n\r\n @PatchMapping(\"/{id}/status\")\r\n public String updateTypoStatus(@PathVariable Long id,\r\n @RequestParam Optional\u003cLong\u003e wksId,\r\n @RequestParam Optional\u003cTypoEvent\u003e event,\r\n @RequestParam Optional\u003cString\u003e next) {\r\n if (wksId.isEmpty() || !workspaceService.existsWorkspaceById(wksId.get())) {\r\n //TODO send to error page\r\n final var e = new WorkspaceNotFoundException(wksId.orElse(0L));\r\n log.error(e.toString(), e);\r\n return \"redirect:/workspaces\";\r\n }\r\n if (event.isEmpty()) {\r\n //TODO send to error page\r\n log.error(\"TypoEvent={} must not be null\", event.orElse(null));\r\n return (\"redirect:/workspace/\") + wksId.get() + next.orElse(\"/typos\");\r\n }\r\n final var updatedTypo = typoService.updateTypoStatus(id, event.get());\r\n if (updatedTypo.isEmpty()) {\r\n //TODO send to error page\r\n final var e = new TypoNotFoundException(id);\r\n log.error(e.getMessage(), e);\r\n }\r\n return (\"redirect:/workspace/\") + wksId.get() + next.orElse(\"/typos\");\r\n }\r\n\r\n}\r\n```\r\n- Authored DesignRule:\r\n```json\r\n[\r\n {\r\n \"index\": \"1724830895\",\r\n \"title\": \"Controller class must have a service field\",\r\n \"description\": \"Controller class must have service class field to handle business logic processing\",\r\n \"tags\": [],\r\n \"checkForFilesFoldersConstraints\": \"INCLUDE\",\r\n \"checkForFilesFolders\": [\r\n \"hexlet-correction/src/main/java/io/hexlet/typoreporter/controller\"\r\n ],\r\n \"processFilesFolders\": \"WITHIN\",\r\n \"quantifierXPathQuery\": [\r\n \"src:unit/src:class\"\r\n ],\r\n \"constraintXPathQuery\": [\r\n \"src:unit/src:class[src:annotation/src:name[text()=\\\"Controller\\\"] and src:specifier[text()=\\\"public\\\"] and src:name[substring(text(),string-length(text())-string-length(\\\"Controller\\\")+1)=\\\"Controller\\\"] and descendant-or-self::src:decl_stmt/src:decl[(src:specifier[text()=\\\"private\\\"] and src:specifier[text()=\\\"final\\\"] and src:name[substring(text(),string-length(text())-string-length(\\\"Service\\\")+1)=\\\"Service\\\"])]]\"\r\n ],\r\n \"grammar\": \"class with declaration statement with ( visibility \\\"private\\\" and specifier \\\"final\\\" and name \\\"...Service\\\" ) must have annotation \\\"Controller\\\" and visibility \\\"public\\\" and name \\\"...Controller\\\" and declaration statement with ( visibility \\\"private\\\" and specifier \\\"final\\\" and name \\\"...Service\\\" )\"\r\n }\r\n]\r\n```","author":{"url":"https://github.com/SaharMehrpour","@type":"Person","name":"SaharMehrpour"},"datePublished":"2024-08-28T16:32:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/28/ActiveDocumentation-webapp/issues/28"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:66637184-e562-929c-728d-8c336bc0d87f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CC76:10664E:E575E:12A110:698E6D45 |
| html-safe-nonce | 89c87e749b8bccc905f6ba984dd8c277641a5faa8433ff079b600068c379bfc4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzc2OjEwNjY0RTpFNTc1RToxMkExMTA6Njk4RTZENDUiLCJ2aXNpdG9yX2lkIjoiMjA1NjcwNzI2OTcwMjA4NTk1NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2208f062f6c49eea3c7bee6cf98bf240ef129975116482ddd791b49ec5c456d6 |
| hovercard-subject-tag | issue:2492545373 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ourcodeinc/ActiveDocumentation-webapp/28/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9ae6b706781e23e17757e30f83cf0d4dc33a38f80f21adf39d7037579ebf7a4a/ourcodeinc/ActiveDocumentation-webapp/issues/28 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9ae6b706781e23e17757e30f83cf0d4dc33a38f80f21adf39d7037579ebf7a4a/ourcodeinc/ActiveDocumentation-webapp/issues/28 |
| og:image:alt | RulePad: Code: package io.hexlet.typoreporter.controller; import io.hexlet.typoreporter.domain.typo.TypoEvent; import io.hexlet.typoreporter.service.TypoService; import io.hexlet.typoreporter.servi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SaharMehrpour |
| hostname | github.com |
| expected-hostname | github.com |
| None | f86603f0b4e9df9a462725324a8c84c98fc50866bdb6ae8ff026fabe56a60c57 |
| turbo-cache-control | no-preview |
| go-import | github.com/ourcodeinc/ActiveDocumentation-webapp git https://github.com/ourcodeinc/ActiveDocumentation-webapp.git |
| octolytics-dimension-user_id | 174141286 |
| octolytics-dimension-user_login | ourcodeinc |
| octolytics-dimension-repository_id | 824700748 |
| octolytics-dimension-repository_nwo | ourcodeinc/ActiveDocumentation-webapp |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 824700748 |
| octolytics-dimension-repository_network_root_nwo | ourcodeinc/ActiveDocumentation-webapp |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7eb8835f5978c5aa7a64336b39e0774a93a9a196 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width