Updated method definition for validateCodeBlock