Skip to content

Commit

Permalink
code optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
peacewong committed Nov 24, 2023
1 parent 774b2bf commit 15e0a8f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.linkis.governance.common.constant;

public class CodeConstants {
// will auto append at end of scala code; make sure the last line is not a comment
public static String SCALA_CODE_AUTO_APPEND_CODE = "val linkisVar=123";
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package org.apache.linkis.governance.common.paser

import org.apache.linkis.common.utils.{CodeAndRunTypeUtils, Logging, Utils}
import org.apache.linkis.governance.common.conf.GovernanceCommonConf
import org.apache.linkis.governance.common.constant.CodeConstants
import org.apache.linkis.governance.common.paser.CodeType.CodeType

import org.apache.commons.lang3.StringUtils
Expand Down Expand Up @@ -116,7 +117,7 @@ class ScalaCodeParser extends SingleCodeParser with Logging {
if (statementBuffer.nonEmpty) codeBuffer.append(statementBuffer.mkString("\n"))
// Make sure the last line is not a comment
codeBuffer.append("\n")
codeBuffer.append("val linkisVar=123")
codeBuffer.append(CodeConstants.SCALA_CODE_AUTO_APPEND_CODE)
codeBuffer.toArray
}

Expand Down

0 comments on commit 15e0a8f

Please sign in to comment.