Skip to content

Commit

Permalink
[ML4SE-234] fixed PR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikrise2 authored and nbirillo committed Nov 28, 2023
1 parent 27d82dd commit f1d8c92
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion config/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ formatting:
complexity:
TooManyFunctions:
thresholdInObjects: 14
thresholdInClasses: 14
thresholdInClasses: 13

performance:
SpreadOperator:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,5 @@ class InitActivity : StartupActivity {
// TODO: show an error message to the user if an error occurs
override fun runActivity(project: Project) {
TaskTrackerPlugin.initializationHandler.setupEnvironment(project) // TODO: move to the start point of the task
TaskTrackerPlugin.mainConfig.scenarioConfig?.let { scenarioConf ->
// scenarioConf.scenario.getNextStep()?.let { scenarioStep ->
// with(ScenarioHandler(TaskTrackerPlugin.mainConfig)) {
// scenarioStep.run()
// }
// } ?: logger.warn("Try to init the plugin, but the scenario is empty or invalid")
} ?: logger.warn("Please, provide a scenario for the plugin behaviour")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,22 @@ data class Scenario(

@Suppress("ReturnCount")
fun getNextUnit(project: Project): ScenarioUnit? {
if (currentStepIterator?.hasNext() != true) {
cleanStepSettings()
val currentStep = getNextStep() ?: return null
currentStep.prepareSettings(project)
currentStepIterator = currentStep.getUnits().iterator()
if (currentStepIterator?.hasNext() != true) {
return null
}
if (!currentStepIterator.notNullAndHasNext()) {
return null
}
cleanStepSettings()
val currentStep = getNextStep() ?: return null
currentStep.prepareSettings(project)
currentStepIterator = currentStep.getUnits().iterator()
return if (currentStepIterator.notNullAndHasNext()) {
currentStepIterator?.next()
} else {
null
}
return currentStepIterator?.next()
}

private fun Iterator<ScenarioUnit>?.notNullAndHasNext() = this?.hasNext() ?: false

private fun cleanStepSettings() =
MainPanelStorage.activeIdeHandlers.forEach {
it.destroy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import java.awt.event.ActionListener
* Note: This class requires JBCefApp to be supported for proper functioning.
*
*/
@Suppress("TooManyFunctions")
class MainPluginPanelFactory : ToolWindowFactory {
// TODO: init in other place, states can be saved between sessions
private val nextButton = createJButton("ui.button.next")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fun Panel.processTask(id: String): Task {
private fun Panel.solveTask(id: String, nextTasks: List<String> = emptyList()) {
val task = processTask(id)
val activityTracker = ActivityTracker(project)
activityTracker.startTracking() // TODO
activityTracker.startTracking() // TODO start tracking for all trackers instead of this one
loadBasePage(SolvePageTemplate(task))
setNextAction {
TaskFileHandler.disposeTask(project, task)
Expand Down

0 comments on commit f1d8c92

Please sign in to comment.