You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/12/20 18:06:00 UTC

[jira] [Work logged] (BEAM-13417) [Playground] Add java preparator to run katas

     [ https://issues.apache.org/jira/browse/BEAM-13417?focusedWorklogId=698870&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-698870 ]

ASF GitHub Bot logged work on BEAM-13417:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 20/Dec/21 18:05
            Start Date: 20/Dec/21 18:05
    Worklog Time Spent: 10m 
      Work Description: pabloem commented on a change in pull request #16172:
URL: https://github.com/apache/beam/pull/16172#discussion_r772570287



##########
File path: playground/backend/internal/preparators/java_preparators.go
##########
@@ -33,19 +38,50 @@ const (
 	newLinePattern                    = "\n"
 	pathSeparatorPattern              = os.PathSeparator
 	tmpFileSuffix                     = "tmp"
+	publicClassNamePattern            = "public class (.*?) [{|implements(.*)]"
 )
 
 // GetJavaPreparators returns preparation methods that should be applied to Java code
 func GetJavaPreparators(filePath string) *[]Preparator {
-	publicClassModification := Preparator{
-		Prepare: replace,
+	removePublicClassPreparator := Preparator{
+		Prepare: removePublicClassModifier,
 		Args:    []interface{}{filePath, classWithPublicModifierPattern, classWithoutPublicModifierPattern},
 	}
-	additionalPackage := Preparator{
-		Prepare: replace,
+	changePackagePreparator := Preparator{
+		Prepare: changePackage,
 		Args:    []interface{}{filePath, packagePattern, importStringPattern},
 	}
-	return &[]Preparator{publicClassModification, additionalPackage}
+	removePackagePreparator := Preparator{
+		Prepare: removePackage,
+		Args:    []interface{}{filePath, packagePattern, newLinePattern},
+	}
+	unitTestFileNameChanger := Preparator{
+		Prepare: changeJavaTestFileName,
+		Args:    []interface{}{filePath},
+	}
+	return &[]Preparator{removePublicClassPreparator, changePackagePreparator, removePackagePreparator, unitTestFileNameChanger}
+}
+
+//changePackage changes the 'package' to 'import' and the last directory in the package value to '*'
+func changePackage(args ...interface{}) error {

Review comment:
       I worry that several of these methods take `args....` but in fact they expect fixed arguments. Could we make them have fixed arguments so that they're more understabdable?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 698870)
    Time Spent: 4h 50m  (was: 4h 40m)

> [Playground] Add java preparator to run katas
> ---------------------------------------------
>
>                 Key: BEAM-13417
>                 URL: https://issues.apache.org/jira/browse/BEAM-13417
>             Project: Beam
>          Issue Type: Task
>          Components: beam-playground
>            Reporter: Pavel Avilov
>            Assignee: Pavel Avilov
>            Priority: P3
>              Labels: beam-playground-backend, beam-playground-beta-launch, beam-playground-sprint-5
>          Time Spent: 4h 50m
>  Remaining Estimate: 0h
>
> Add java preparator to run katas: preparator should remove the package line in the received katas.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)